> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or update quotes, orders, invoices and credits



## OpenAPI

````yaml /api-reference/openapi.json put /v1/documents
openapi: 3.1.0
info:
  title: Elastly API
  version: '2026-11-01'
servers:
  - url: https://api.elastly.ai
security: []
paths:
  /v1/documents:
    put:
      summary: Create or update quotes, orders, invoices and credits
      operationId: upsertDocuments
      parameters:
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: Elastly-Version
          in: header
        - schema:
            type: string
            pattern: ^[\x21-\x7e]{1,255}$
          required: true
          name: Idempotency-Key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                records:
                  type: array
                  items:
                    type: object
                    properties:
                      externalKey:
                        type: string
                        minLength: 1
                        maxLength: 255
                      sequence:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      updatedAt:
                        type: string
                        format: date-time
                      deleted:
                        type: boolean
                      fields:
                        anyOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                enum:
                                  - quote
                              number:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              customer:
                                type: string
                                minLength: 1
                                maxLength: 255
                              date:
                                type: string
                                format: date
                              currency:
                                type: string
                                pattern: ^[A-Z]{3}$
                              exchangeRate:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              total:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              intercompany:
                                type: boolean
                              siteKey:
                                type: string
                                minLength: 1
                                maxLength: 255
                              siteName:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              siteCountry:
                                type: string
                                pattern: ^[A-Z]{2}$
                              modifiedAt:
                                type: string
                                format: date-time
                              lines:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    lineId:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    product:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    quantity:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    amount:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    lineKind:
                                      type: string
                                      enum:
                                        - product
                                        - discount
                                        - markup
                                    appliesToLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    costEstimate:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    costBasis:
                                      type: string
                                      enum:
                                        - estimated
                                        - current-average
                                    location:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceDocument:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    priceId:
                                      type: string
                                      minLength: 1
                                      maxLength: 120
                                      description: >-
                                        The priceId of the /v1/price line this
                                        order line was sold at. An order line
                                        that echoes it is linked to that price
                                        decision.
                                    version:
                                      type: integer
                                      minimum: 0
                                      maximum: 9007199254740991
                                      description: >-
                                        The version returned with the echoed
                                        priceId. It is accepted for reference
                                        and not stored.
                                  required:
                                    - lineId
                                    - product
                                    - quantity
                                    - amount
                                  additionalProperties: false
                                minItems: 1
                                maxItems: 5000
                              status:
                                type: string
                                enum:
                                  - open
                                  - won
                                  - lost
                            required:
                              - kind
                              - number
                              - customer
                              - date
                              - currency
                              - lines
                            additionalProperties: false
                          - type: object
                            properties:
                              kind:
                                type: string
                                enum:
                                  - order
                              number:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              customer:
                                type: string
                                minLength: 1
                                maxLength: 255
                              date:
                                type: string
                                format: date
                              currency:
                                type: string
                                pattern: ^[A-Z]{3}$
                              exchangeRate:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              total:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              intercompany:
                                type: boolean
                              siteKey:
                                type: string
                                minLength: 1
                                maxLength: 255
                              siteName:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              siteCountry:
                                type: string
                                pattern: ^[A-Z]{2}$
                              modifiedAt:
                                type: string
                                format: date-time
                              lines:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    lineId:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    product:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    quantity:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    amount:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    lineKind:
                                      type: string
                                      enum:
                                        - product
                                        - discount
                                        - markup
                                    appliesToLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    costEstimate:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    costBasis:
                                      type: string
                                      enum:
                                        - estimated
                                        - current-average
                                    location:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceDocument:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    priceId:
                                      type: string
                                      minLength: 1
                                      maxLength: 120
                                      description: >-
                                        The priceId of the /v1/price line this
                                        order line was sold at. An order line
                                        that echoes it is linked to that price
                                        decision.
                                    version:
                                      type: integer
                                      minimum: 0
                                      maximum: 9007199254740991
                                      description: >-
                                        The version returned with the echoed
                                        priceId. It is accepted for reference
                                        and not stored.
                                  required:
                                    - lineId
                                    - product
                                    - quantity
                                    - amount
                                  additionalProperties: false
                                minItems: 1
                                maxItems: 5000
                              status:
                                type: string
                                enum:
                                  - pending-approval
                                  - booked
                                  - cancelled
                                  - partially-fulfilled
                                  - pending-billing
                                  - billed
                                  - closed
                              sourceQuote:
                                type: string
                                minLength: 1
                                maxLength: 255
                            required:
                              - kind
                              - number
                              - customer
                              - date
                              - currency
                              - lines
                            additionalProperties: false
                          - type: object
                            properties:
                              kind:
                                type: string
                                enum:
                                  - invoice
                              number:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              customer:
                                type: string
                                minLength: 1
                                maxLength: 255
                              date:
                                type: string
                                format: date
                              currency:
                                type: string
                                pattern: ^[A-Z]{3}$
                              exchangeRate:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              total:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              intercompany:
                                type: boolean
                              siteKey:
                                type: string
                                minLength: 1
                                maxLength: 255
                              siteName:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              siteCountry:
                                type: string
                                pattern: ^[A-Z]{2}$
                              modifiedAt:
                                type: string
                                format: date-time
                              lines:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    lineId:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    product:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    quantity:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    amount:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    lineKind:
                                      type: string
                                      enum:
                                        - product
                                        - discount
                                        - markup
                                    appliesToLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    costEstimate:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    costBasis:
                                      type: string
                                      enum:
                                        - estimated
                                        - current-average
                                    location:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceDocument:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    priceId:
                                      type: string
                                      minLength: 1
                                      maxLength: 120
                                      description: >-
                                        The priceId of the /v1/price line this
                                        order line was sold at. An order line
                                        that echoes it is linked to that price
                                        decision.
                                    version:
                                      type: integer
                                      minimum: 0
                                      maximum: 9007199254740991
                                      description: >-
                                        The version returned with the echoed
                                        priceId. It is accepted for reference
                                        and not stored.
                                  required:
                                    - lineId
                                    - product
                                    - quantity
                                    - amount
                                  additionalProperties: false
                                minItems: 1
                                maxItems: 5000
                              sourceDocuments:
                                type: array
                                items:
                                  type: string
                                  minLength: 1
                                  maxLength: 255
                                maxItems: 100
                              dueDate:
                                type: string
                                format: date
                              paymentStatus:
                                type: string
                                enum:
                                  - open
                                  - paid
                              paidDate:
                                type: string
                                format: date
                            required:
                              - kind
                              - number
                              - customer
                              - date
                              - currency
                              - lines
                            additionalProperties: false
                          - type: object
                            properties:
                              kind:
                                type: string
                                enum:
                                  - credit
                              number:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              customer:
                                type: string
                                minLength: 1
                                maxLength: 255
                              date:
                                type: string
                                format: date
                              currency:
                                type: string
                                pattern: ^[A-Z]{3}$
                              exchangeRate:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              total:
                                type: string
                                pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                              intercompany:
                                type: boolean
                              siteKey:
                                type: string
                                minLength: 1
                                maxLength: 255
                              siteName:
                                type: string
                                minLength: 1
                                maxLength: 1000
                              siteCountry:
                                type: string
                                pattern: ^[A-Z]{2}$
                              modifiedAt:
                                type: string
                                format: date-time
                              lines:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    lineId:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    product:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    quantity:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    amount:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    lineKind:
                                      type: string
                                      enum:
                                        - product
                                        - discount
                                        - markup
                                    appliesToLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    costEstimate:
                                      type: string
                                      pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
                                    costBasis:
                                      type: string
                                      enum:
                                        - estimated
                                        - current-average
                                    location:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceDocument:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    sourceLine:
                                      type: string
                                      minLength: 1
                                      maxLength: 255
                                    priceId:
                                      type: string
                                      minLength: 1
                                      maxLength: 120
                                      description: >-
                                        The priceId of the /v1/price line this
                                        order line was sold at. An order line
                                        that echoes it is linked to that price
                                        decision.
                                    version:
                                      type: integer
                                      minimum: 0
                                      maximum: 9007199254740991
                                      description: >-
                                        The version returned with the echoed
                                        priceId. It is accepted for reference
                                        and not stored.
                                  required:
                                    - lineId
                                    - product
                                    - quantity
                                    - amount
                                  additionalProperties: false
                                minItems: 1
                                maxItems: 5000
                              sourceDocuments:
                                type: array
                                items:
                                  type: string
                                  minLength: 1
                                  maxLength: 255
                                maxItems: 100
                            required:
                              - kind
                              - number
                              - customer
                              - date
                              - currency
                              - lines
                            additionalProperties: false
                          - type: object
                            properties:
                              kind:
                                type: string
                                enum:
                                  - quote
                                  - order
                                  - invoice
                                  - credit
                            required:
                              - kind
                            additionalProperties: false
                    required:
                      - externalKey
                      - fields
                    additionalProperties: false
                  minItems: 1
                  maxItems: 100
              required:
                - records
              additionalProperties: false
      responses:
        '202':
          description: Create or update quotes, orders, invoices and credits
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
            Idempotent-Replayed:
              description: >-
                Present and true when the response replays an earlier request
                with the same idempotency key
              schema:
                type: string
                enum:
                  - 'true'
          content:
            application/json:
              schema:
                type: object
                properties:
                  importId:
                    type: string
                    format: uuid
                  records:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                          minimum: 0
                        externalKey:
                          type:
                            - string
                            - 'null'
                        state:
                          type: string
                          enum:
                            - accepted
                            - failed
                            - stale
                        errors:
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type:
                                  - string
                                  - 'null'
                              code:
                                type: string
                                minLength: 1
                              message:
                                type: string
                                minLength: 1
                            required:
                              - field
                              - code
                              - message
                            additionalProperties: false
                        notices:
                          type: array
                          items:
                            type: object
                            properties:
                              field:
                                type:
                                  - string
                                  - 'null'
                              code:
                                type: string
                                minLength: 1
                              message:
                                type: string
                                minLength: 1
                            required:
                              - field
                              - code
                              - message
                            additionalProperties: false
                      required:
                        - index
                        - externalKey
                        - state
                      additionalProperties: false
                required:
                  - importId
                  - records
                additionalProperties: false
        '400':
          description: >-
            unsupported_api_version, invalid_request, idempotency_key_required,
            invalid_idempotency_key
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: unauthenticated
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: >-
            insufficient_scope, plan_required, workspace_read_only,
            workspace_locked, workspace_purging
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: connection_unavailable, idempotency_request_in_progress
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '413':
          description: invalid_request
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: idempotency_key_reused
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: rate_limited
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: service_unavailable, connection_unavailable
          headers:
            Elastly-Version:
              description: The API version that served the response
              schema:
                type: string
            Retry-After:
              description: Seconds to wait before retrying the request
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - apiKey: []
components:
  schemas:
    ApiError:
      type: object
      properties:
        error:
          type: string
          enum:
            - invalid_request
            - unauthenticated
            - access_denied
            - rate_limited
            - plan_required
            - workspace_read_only
            - workspace_locked
            - workspace_purging
            - service_unavailable
            - insufficient_scope
            - not_found
            - idempotency_key_reused
            - idempotency_key_required
            - invalid_idempotency_key
            - idempotency_request_in_progress
            - unsupported_api_version
            - invalid_cursor
            - quote_ref_customer_mismatch
            - channel_publishing
            - connection_unavailable
            - import_not_found
            - import_state_conflict
            - file_too_large
            - unsupported_format
            - writeback_unavailable
            - write_access_revoked
            - writeback_paused
            - too_many_claims
            - quote_not_found
        requestId:
          type: string
      required:
        - error
        - requestId
      additionalProperties: false
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.