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

# Order detail



## OpenAPI

````yaml /openapi.json get /api/v1/orders/{id}
openapi: 3.1.0
info:
  title: PagAmerican Data API
  version: 1.0.0
  description: >-
    Sales analytics API for external consumers (creators and affiliates), served
    from ClickHouse in near real time.


    **Authentication:** send your API key (`pag_...`) directly in the
    `Authorization: Bearer <your_key>` header. There is no token exchange — the
    opaque key is the Bearer token itself.


    **Dates:** `from`/`to` are `YYYY-MM-DD` at 00:00:00 UTC; `from` is
    inclusive, `to` is exclusive. Max window 90 days. `/purchases` and `/orders`
    filter by **checkout initialization** (`checkoutInitializedAt`);
    `/checkouts` by load time; `/abandoned-carts` by session start; `/refunds`
    by request time.


    **Tenant scope:** you only receive your own account's data — isolation is
    enforced automatically by the key.
servers:
  - url: https://external-api-service.pagamerican.app
    description: Production
  - url: https://external-api-service.pagamerican.net
    description: Staging
security:
  - apiKey: []
tags:
  - name: purchases
    description: Purchases (creator and affiliate)
  - name: orders
    description: Orders (creator only)
  - name: products
    description: Product catalog (creator only)
  - name: offers
    description: Offer catalog (creator only)
  - name: checkouts
    description: Checkout sessions (creator only)
  - name: abandoned-carts
    description: Abandoned carts (creator only)
  - name: refunds
    description: Refunds, chargebacks and alerts (creator and affiliate)
  - name: health
    description: Service status
paths:
  /api/v1/orders/{id}:
    get:
      tags:
        - orders
      summary: Order detail
      parameters:
        - name: id
          in: path
          required: true
          description: order_id
          schema:
            type: integer
      responses:
        '200':
          description: Detail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderDetail'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - apiKey: []
components:
  schemas:
    OrderDetail:
      allOf:
        - $ref: '#/components/schemas/Order'
        - type: object
          properties:
            hasUpsellRoot:
              type: boolean
            sentToSupplierAt:
              type: string
            supplierConfirmedAt:
              type: string
            trackingRegisteredAt:
              type: string
            carrierPickedUpAt:
              type: string
            availableForPickupAt:
              type: string
            outForDeliveryAt:
              type: string
            firstDeliveryFailedAt:
              type: string
            firstExceptionAt:
              type: string
            deliveryFailedCount:
              type: integer
            exceptionCount:
              type: integer
    Order:
      type: object
      properties:
        orderId:
          type: integer
          example: 129156
        orderUcode:
          type: string
        checkoutId:
          type: string
        currency:
          type: string
          example: usd
        source:
          type: string
          example: internal
        creatorName:
          type: string
        offerCode:
          type: string
        offerName:
          type: string
        productName:
          type: string
        supplierName:
          type: string
          example: RedRock
        psp:
          type: string
        paymentMethod:
          type: string
        cardBrand:
          type: string
        cardLast4:
          type: string
        customerName:
          type: string
          description: (customer PII)
        customerEmail:
          type: string
          description: (customer PII)
        customerPhone:
          type: string
          description: (customer PII)
        shippingAddress1:
          type: string
          description: (customer PII)
        shippingAddress2:
          type: string
          description: (customer PII)
        shippingCity:
          type: string
          description: (customer PII)
        shippingState:
          type: string
          description: (customer PII)
        shippingCountry:
          type: string
          description: (customer PII)
        shippingZipcode:
          type: string
          description: (customer PII)
        amountItemsGross:
          type: number
        amountItemsNet:
          type: number
        amountShippingNet:
          type: number
        amountTaxes:
          type: number
        amountTransaction:
          type: number
        amountPlatformFee:
          type: number
        amountAffiliation:
          type: number
        amountCreatorNet:
          type: number
        amountCreatorPlatformFee:
          type: number
        amountCreatorTax:
          type: number
        amountRefunded:
          type: number
        purchaseCount:
          type: integer
        upsellCount:
          type: integer
        lastTrackingMilestone:
          type: string
        trackingProvider:
          type: string
          example: 17track
        trackingCode:
          type: string
        trackingCarrier:
          type: string
        checkoutInitializedAt:
          type: string
          description: Column used for the from/to filter
        orderCreatedAt:
          type: string
        orderCompletedAt:
          type: string
        deliveredAt:
          type: string
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_request
            message:
              type: string
              example: from must be before to
            correlation_id:
              type: string
              example: a1b2c3d4-...
  responses:
    BadRequest:
      description: Invalid parameters (malformed dates, from > to)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, or revoked key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Insufficient scope or persona not allowed for this resource
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Record not found for your tenant
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Your opaque API key (`pag_...`) sent directly as the Bearer token. There
        is no token/JWT exchange.

````