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

# Get Order by ID

> Returns a single order based on the ID supplied

## Get Order by ID

Returns a single order by `orderId`, or orders matching `mdasc` when passed as query parameter. Requires scope `orders:read`.

### HTTP Request

```http theme={null}
GET https://api-beta.lomadee.com.br/affiliate/orders/{orderId}
```

### Path Parameters

| Parameter | Description                  |
| --------- | ---------------------------- |
| `id`      | Order identifier (`orderId`) |

### Query Parameters

| Parameter | Description                                                  |
| --------- | ------------------------------------------------------------ |
| `mdasc`   | When set, returns matching orders as array with `meta.total` |

### Response (by orderId)

```json theme={null}
{
  "data": {
    "orderId": "12345",
    "organizationId": "..."
  }
}
```

### Example

```bash theme={null}
curl -X GET "https://api-beta.lomadee.com.br/affiliate/orders/ORDER-123" \
  -H "x-api-key: your-api-key"
```


## OpenAPI

````yaml GET /affiliate/orders/{id}
openapi: 3.1.0
info:
  title: Lomadee Public API
  description: >-
    REST API for affiliate brands, channels, campaigns, orders, products, and
    link shortener. Authenticate with x-api-key. Rate limit: 60 req/60s per key
    and IP.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.lomadee.com.br/
    description: Production — target URL for all integrations
  - url: https://api-beta.lomadee.com.br/
    description: Beta (legacy) — available during transition; will be retired soon
security:
  - x-api-key: []
paths:
  /affiliate/orders/{id}:
    get:
      description: Returns a single order based on the ID supplied
      parameters:
        - name: id
          in: path
          description: The id of the order to return
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Order response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/AffiliateOrder'
          headers:
            X-RateLimit-Limit:
              description: Max requests per window
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Remaining requests in window
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp when window resets
              schema:
                type: integer
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    AffiliateOrder:
      required: []
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              description: The id of the order in the affiliate network
              type: string
            orderId:
              description: The id of the order in the merchant's system
              type: string
            status:
              description: The status of the order
              type: string
              enum:
                - pending
                - approved
                - rejected
                - repproved
            value:
              description: The value of the order
              type: number
            createdAt:
              description: The date and time the order was created
              type: string
            commission:
              description: The commission of the order
              type: number
            commissionStatus:
              description: The commission status of the order
              type: string
              enum:
                - pending
                - approved
                - rejected
                - repproved
            'items  ':
              description: The items of the order
              type: array
              items:
                type: object
                properties:
                  id:
                    description: The id of the item
                    type: string
                  name:
                    description: The name of the item
                    type: string
                  quantity:
                    description: The quantity of the item
                    type: number
                  price:
                    description: The price of the item
                    type: number
                  categories:
                    description: The commission of the item
                    type: number
            organizationId:
              description: The id of the brand that the order belongs to
              type: string
            mdasc:
              description: >-
                This field returns the mdasc, which is a custom identifier used
                to track the order for your custom purposes
              type: string
        meta:
          $ref: '#/components/schemas/Meta'
    Error:
      required:
        - message
        - error
        - statusCode
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        error:
          type: string
          description: Error type/category
        statusCode:
          type: integer
          format: int32
          description: HTTP status code
    Meta:
      type: object
      properties:
        total:
          type: integer
        page:
          type: integer
        limit:
          type: integer
        totalPages:
          type: integer
  responses:
    Unauthorized:
      description: API key missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
    Forbidden:
      description: Valid key without required scope
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
    TooManyRequests:
      description: Rate limit exceeded (60 req/60s per key + IP)
      headers:
        X-RateLimit-Limit:
          description: Max requests per window
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Remaining requests in window
          schema:
            type: integer
        X-RateLimit-Reset:
          description: Unix timestamp when window resets
          schema:
            type: integer
        Retry-After:
          description: Seconds until retry
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````