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

# Stage records

> Stage up to 1000 canonical records into an open batch.

<Note>
  This endpoint writes to your workspace, so the interactive playground is turned off for it. Copy
  the request and run it against your own workspace with a connector-scope key.
</Note>


## OpenAPI

````yaml POST /api/v1/ingest/batches/{batchId}/records
openapi: 3.1.0
info:
  title: Elastly API
  version: 1.0.0
  description: >-
    Elastly public API v1: price serving, canonical ingest, write-back claims
    and webhooks. Authenticate every request with an API key: Authorization:
    Bearer elastly_live_...
  contact:
    name: Elastly
    url: https://elastly.io
    email: support@elastly.io
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://app.elastly.io
security:
  - apiKey: []
tags:
  - name: prices
    description: 'Price serving: batch, idempotent, explainable.'
  - name: ingest
    description: Staged canonical ingest drained by the sync engine.
  - name: writebacks
    description: Claim and acknowledge approved price write-backs.
paths:
  /api/v1/ingest/batches/{batchId}/records:
    post:
      tags:
        - ingest
      summary: Stage up to 1000 canonical records into an open batch
      operationId: stageIngestRecords
      parameters:
        - name: batchId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StageRecordsRequest'
      responses:
        '202':
          description: Records staged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StageRecordsResponse'
        '401':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '402':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: Error envelope with a stable machine-readable code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    StageRecordsRequest:
      $schema: https://json-schema.org/draft/2020-12/schema
      oneOf:
        - type: object
          properties:
            entity:
              type: string
              const: product
            records:
              minItems: 1
              maxItems: 1000
              type: array
              items:
                type: object
                properties:
                  sku:
                    type: string
                    minLength: 1
                  externalId:
                    type: string
                    minLength: 1
                  name:
                    type: string
                  category:
                    type: string
                  costCents:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  currentPriceCents:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  mapCents:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  floorCents:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  ceilingCents:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                  isActive:
                    type: boolean
                  inStock:
                    type: boolean
                  stockOnHand:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  brand:
                    type: string
                  currency:
                    type: string
                  attributes:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                required:
                  - sku
                  - name
                  - category
                  - costCents
                  - currentPriceCents
          required:
            - entity
            - records
        - type: object
          properties:
            entity:
              type: string
              const: customer
            records:
              minItems: 1
              maxItems: 1000
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  externalId:
                    type: string
                    minLength: 1
                  segment:
                    type: string
                  region:
                    anyOf:
                      - type: string
                      - type: 'null'
                  country:
                    anyOf:
                      - type: string
                      - type: 'null'
                  creditTerms:
                    anyOf:
                      - type: string
                      - type: 'null'
                  currency:
                    anyOf:
                      - type: string
                      - type: 'null'
                  isActive:
                    type: boolean
                  attributes:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                required:
                  - name
                  - externalId
          required:
            - entity
            - records
        - type: object
          properties:
            entity:
              type: string
              const: quote
            records:
              minItems: 1
              maxItems: 1000
              type: array
              items:
                type: object
                properties:
                  externalId:
                    type: string
                    minLength: 1
                  customerExternalId:
                    type: string
                    minLength: 1
                  outcome:
                    type: string
                    enum:
                      - open
                      - won
                      - lost
                  currency:
                    anyOf:
                      - type: string
                      - type: 'null'
                  exchangeRate:
                    anyOf:
                      - type: number
                      - type: 'null'
                  createdAt:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                  decidedAt:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                  lostReason:
                    anyOf:
                      - type: string
                      - type: 'null'
                  lines:
                    minItems: 1
                    type: array
                    items:
                      type: object
                      properties:
                        productSku:
                          type: string
                          minLength: 1
                        quantity:
                          type: number
                          exclusiveMinimum: 0
                        costCents:
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        quotedPriceCents:
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        pricingDecisionId:
                          anyOf:
                            - type: string
                            - type: 'null'
                        elastlyQuotedPriceCents:
                          anyOf:
                            - type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                            - type: 'null'
                        salespersonPriceReason:
                          anyOf:
                            - type: string
                            - type: 'null'
                        attributes:
                          type: object
                          propertyNames:
                            type: string
                          additionalProperties: {}
                      required:
                        - productSku
                        - quantity
                        - costCents
                        - quotedPriceCents
                        - pricingDecisionId
                required:
                  - externalId
                  - customerExternalId
                  - outcome
                  - createdAt
                  - lines
          required:
            - entity
            - records
        - type: object
          properties:
            entity:
              type: string
              const: order
            records:
              minItems: 1
              maxItems: 1000
              type: array
              items:
                type: object
                properties:
                  externalId:
                    type: string
                    minLength: 1
                  customerExternalId:
                    anyOf:
                      - type: string
                        minLength: 1
                      - type: 'null'
                  sourceQuoteExternalId:
                    type: string
                  currency:
                    type: string
                  exchangeRate:
                    anyOf:
                      - type: number
                      - type: 'null'
                  soldAt:
                    type: string
                    format: date-time
                    pattern: >-
                      ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                  lines:
                    minItems: 1
                    type: array
                    items:
                      type: object
                      properties:
                        productSku:
                          type: string
                          minLength: 1
                        quantity:
                          type: number
                          exclusiveMinimum: 0
                        costCents:
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        soldPriceCents:
                          type: integer
                          minimum: 0
                          maximum: 9007199254740991
                        attributes:
                          type: object
                          propertyNames:
                            type: string
                          additionalProperties: {}
                      required:
                        - productSku
                        - quantity
                        - costCents
                        - soldPriceCents
                required:
                  - externalId
                  - currency
                  - soldAt
                  - lines
          required:
            - entity
            - records
    StageRecordsResponse:
      $schema: https://json-schema.org/draft/2020-12/schema
      readOnly: true
      type: object
      properties:
        staged:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
      required:
        - staged
    ApiError:
      $schema: https://json-schema.org/draft/2020-12/schema
      readOnly: true
      type: object
      properties:
        error:
          readOnly: true
          type: object
          properties:
            code:
              type: string
              enum:
                - unauthorized
                - forbidden
                - feature_not_enabled
                - subscription_inactive
                - rate_limited
                - monthly_volume_exceeded
                - invalid_request
                - invalid_json
                - unknown_product
                - unknown_customer
                - no_cost_basis
                - fx_rate_unavailable
                - fx_rate_stale
                - idempotency_key_reused
                - idempotency_key_in_flight
                - batch_not_found
                - batch_already_committed
                - batch_entity_order_violation
                - entity_not_supported
                - writeback_lease_expired
                - internal_error
            message:
              type: string
            param:
              type: string
            requestId:
              type: string
          required:
            - code
            - message
            - requestId
      required:
        - error
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Elastly API key. Scopes: erp (price serving), connector (ingest +
        write-backs), storefront.

````