# salesOrder query


`salesOrder` is a GraphQL query of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Returns one sales order. Use it to read back an order you placed, by its MAX `id` or by the
`source` and `externalId` you placed it with.

- Requires the `order.read` permission.
- Returns null when the order does not exist or your API key cannot see it.

## Arguments

- `ref`: [`SalesOrderRefInput!`](/chameleoon-max/type/sales-order-ref-input) · required

## Returns

[`SalesOrder`](/chameleoon-max/type/sales-order)

## Example

**Query**

```graphql
query salesOrder($ref: SalesOrderRefInput!) {
  salesOrder(ref: $ref) {
    id
    number
    status
    legalEntityId
    source
    externalId
    externalNumber
    sourceUrl
    orderedAt
    confirmedAt
    fulfilmentStatus
    paymentStatus
    currencyCode
    pricesIncludeVat
    totalNet
    totalVat
    totalGross
    paidAmount
    discountPercent
    invoiceNumber
    invoiceExternalId
    vatTreatment
    vatDestinationCountry
    customerId
    customer {
      id
      code
      name
      registrationId
      taxId
      vatId
    }
    billingAddress {
      id
      recipient
      company
      district
      regionCode
      houseNumber
    }
    deliveryAddress {
      id
      recipient
      company
      district
      regionCode
      houseNumber
    }
    pickupPoint {
      code
      name
    }
    sourceDeliveryMethod {
      code
      name
    }
    carrier {
      code
      profile
      name
      service
    }
    paymentMethod
    sourcePaymentMethod {
      code
      name
    }
    contactEmail
    contactPhone
    preferredWarehouseId
    preferredWarehouse {
      id
      code
      name
      street
      city
      postalCode
    }
    note
    internalNote
    billingAddressEditedInErp
    deliveryAddressEditedInErp
    itemsEditedInErp
    customerErased
    items(first: 10) {
      totalCount
    }
    charges(first: 10) {
      totalCount
    }
    blocked {
      reason
      note
      at
    }
    exceptions(first: 10) {
      totalCount
    }
    externalRefs(first: 10) {
      totalCount
    }
    documents(first: 10) {
      totalCount
    }
    changedAt
    fulfilments(first: 10) {
      totalCount
    }
    invoices(first: 10) {
      totalCount
    }
    governingInvoice {
      id
      direction
      kind
      status
      failureReason
      source
    }
    invoicePdfReady
    shipments(first: 10) {
      totalCount
    }
  }
}
```

**Variables**

```json
{
  "ref": {
    "id": "00000000-0000-4000-8000-000000000001"
  }
}
```

**Response**

```json
{
  "data": {
    "salesOrder": {
      "id": "00000000-0000-4000-8000-000000000001",
      "number": "example",
      "status": "DRAFT",
      "legalEntityId": "00000000-0000-4000-8000-000000000001",
      "source": "example",
      "externalId": "example",
      "externalNumber": "example",
      "sourceUrl": "example",
      "orderedAt": "2026-01-01T00:00:00Z",
      "confirmedAt": "2026-01-01T00:00:00Z",
      "fulfilmentStatus": "UNFULFILLED",
      "paymentStatus": "UNPAID",
      "currencyCode": "example",
      "pricesIncludeVat": true,
      "totalNet": "10.00",
      "totalVat": "10.00",
      "totalGross": "10.00",
      "paidAmount": "10.00",
      "discountPercent": "10.00",
      "invoiceNumber": "example",
      "invoiceExternalId": "example",
      "vatTreatment": "DOMESTIC",
      "vatDestinationCountry": "example",
      "customerId": "00000000-0000-4000-8000-000000000001",
      "customer": {
        "id": "00000000-0000-4000-8000-000000000001",
        "code": "example",
        "name": "example",
        "registrationId": "example",
        "taxId": "example",
        "vatId": "example"
      },
      "billingAddress": {
        "id": "00000000-0000-4000-8000-000000000001",
        "recipient": "example",
        "company": "example",
        "district": "example",
        "regionCode": "example",
        "houseNumber": "example"
      },
      "deliveryAddress": {
        "id": "00000000-0000-4000-8000-000000000001",
        "recipient": "example",
        "company": "example",
        "district": "example",
        "regionCode": "example",
        "houseNumber": "example"
      },
      "pickupPoint": {
        "code": "example",
        "name": "example"
      },
      "sourceDeliveryMethod": {
        "code": "example",
        "name": "example"
      },
      "carrier": {
        "code": "example",
        "profile": "example",
        "name": "example",
        "service": "example"
      },
      "paymentMethod": "CARD",
      "sourcePaymentMethod": {
        "code": "example",
        "name": "example"
      },
      "contactEmail": "example",
      "contactPhone": "example",
      "preferredWarehouseId": "00000000-0000-4000-8000-000000000001",
      "preferredWarehouse": {
        "id": "00000000-0000-4000-8000-000000000001",
        "code": "example",
        "name": "example",
        "street": "example",
        "city": "example",
        "postalCode": "example"
      },
      "note": "example",
      "internalNote": "example",
      "billingAddressEditedInErp": true,
      "deliveryAddressEditedInErp": true,
      "itemsEditedInErp": true,
      "customerErased": true,
      "items": {
        "totalCount": 1
      },
      "charges": {
        "totalCount": 1
      },
      "blocked": {
        "reason": "example",
        "note": "example",
        "at": "2026-01-01T00:00:00Z"
      },
      "exceptions": {
        "totalCount": 1
      },
      "externalRefs": {
        "totalCount": 1
      },
      "documents": {
        "totalCount": 1
      },
      "changedAt": "2026-01-01T00:00:00Z",
      "fulfilments": {
        "totalCount": 1
      },
      "invoices": {
        "totalCount": 1
      },
      "governingInvoice": {
        "id": "00000000-0000-4000-8000-000000000001",
        "direction": "ISSUED",
        "kind": "INVOICE",
        "status": "PENDING",
        "failureReason": "example",
        "source": "example"
      },
      "invoicePdfReady": true,
      "shipments": {
        "totalCount": 1
      }
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
