# Orders

GET `https://app.iteras.dk/api/orders/`

The API key must allow "Retrieve order data".

Lists orders placed through the ordering forms, newest first.

Orders are always placed through ordering forms, either through the UI or through the [place order API](/api/docs/server/placeorder.md). The orders are not usually visible inside the Iteras UI, except orders awaiting approval.

The orders can be orders in any state, so both completed orders, orders awaiting approval and orders where the customer has not completed the payment.

An order can also hand its ID and selected fields directly to the page shown after ordering - see [order data on the redirect](/api/docs/js/iframes.md#order-data-on-the-redirect) - so that page can look the order up here without searching.

## Parameters

All parameters are optional.

- `fields` (string, Defaults to `data`): A comma-separated list of fields to return in the JSON, e.g. `fields=data,invoice_lines`.
  - `data`: All fields directly on the order. When left out, only `id` is returned.
  - `invoice_lines` (with `fields=data`): Estimated invoice lines from ordered campaigns and products. These are calculated at the time of the API request (not at the time the order was made).
- `order_id` (string): ID of a specific order, e.g. `order_id=83529`.
- `customer` (string): Orders made by a specific customer with the provided customer ID, e.g. `customer=9224437`. These orders are either completed or the customer has logged in as part of ordering.
- `campaign` (string): Orders where a selected product represents one of these campaigns, by campaign ID, repeating the parameter for each, e.g. `campaign=3i&campaign=12m`.
- `status` (string): Orders with these statuses, repeating the parameter for each, e.g. `status=awaitingapproval&status=denied`.

  One of:

  - `awaitingconfirmation`
  - `awaitingpaymentprocessor`
  - `awaitingemailconfirmation`
  - `awaitingapproval`
  - `approved`
  - `denied`
- `created_before` (date): Orders created on or before the date, given as `YYYY-MM-DD`.
- `created_after` (date): Orders created on or after the date, given as `YYYY-MM-DD`.
- `max_results` (integer, Defaults to `10000`): How many orders to retrieve at most, e.g. `max_results=1000`, clipped to between 1 and 10000. The newest orders are returned first. If there are more results available, a `next_url` is returned which you can use to grab the next page.
- `iframe` (bool): Set if returned URLs are intended to go in an iframe, e.g. `iframe=1`.

## Return value

The data returned is an object with an array of order information (possibly empty array). A maximum of 10.000 orders are returned so make sure to use the `created_before` and/or `created_after` parameters if you have a lot of orders to fetch. If there are more orders than `max_results`, the response also contains a `next_url` you can use to fetch the next page.

Note that the content depends on what fields have been set up inside Iteras and filled in on a given order. In general, only filled-in fields are returned, so for instance if the order form does not include a specific field or the field is not filled in, it won't show up in the data for the order.

Each order object always contains its `id`. The remaining attributes below are returned when `fields` includes `data`, which is the default.

- `id` (string): ID of the order, e.g. `83529`.
- `created` (datetime): When the order was placed, as `YYYY-MM-DDTHH:MM:SS`, e.g. `2026-09-24T04:18:46`.
- `ordering_form` (string): URL ID of the form the order was placed through, e.g. `3-months`.
- `status` (string): One of:
  - `awaitingconfirmation`
  - `awaitingpaymentprocessor`
  - `awaitingemailconfirmation`
  - `awaitingapproval`
  - `approved`
  - `denied`
- `products` (array): The products and campaigns chosen in the order, e.g. `[{"text": "3 issues (100,00 DKK)", "quantity": 1, "campaign_id": "3i", "price": 100.0, "currency": "DKK"}]`.

  A chosen campaign has these attributes:

  - `text` (string): The product text used when ordering, e.g. `3 issues (100,00 DKK)`.
  - `quantity` (integer): The quantity ordered, present only when it is other than 1.
  - `campaign_id` (string): The campaign's ID, e.g. `3i`.
  - `campaign_name` (string): The campaign's internal name.
  - `campaign_customer_facing_name` (string): The campaign's customer-facing name.
  - `subscribed_to` (array): The products the campaign subscribes to, each with `name` and `external_id`.
  - `price` (decimal): The computed price of the campaign, e.g. `100.0`.
  - `currency` (string): The currency of the computed price, e.g. `DKK`.
  - `invoice_lines` (array, with `fields=data,invoice_lines`): The estimated invoice lines for the campaign, in the [invoice line format](/api/docs/server/invoicelinesformat.md), computed at the time of the request.

  A stand-alone product has these attributes:

  - `text` (string): The product text used when ordering, e.g. `A good book at a good price (50,00 DKK)`.
  - `quantity` (integer): The quantity ordered, present only when it is other than 1.
  - `name` (string): The product's internal name.
  - `customer_facing_name` (string): The product's customer-facing name.
  - `external_id` (string): The product's external ID, e.g. `book_offer_34`.
  - `price` (decimal): The computed price of the product, e.g. `50.0`.
  - `currency` (string): The currency of the computed price, e.g. `DKK`.
  - `invoice_lines` (array, with `fields=data,invoice_lines`): The estimated invoice lines for the product, in the [invoice line format](/api/docs/server/invoicelinesformat.md), computed at the time of the request.

  Any filled-in product fields are also returned under their field key.
- `resume_ordering_url` (string): A link back to the order so the customer can resume it, e.g. `https://app.iteras.dk/example/iframe/order/myOrderingForm/?order=vnt3eb683b4833v8`. Only present if `status` is `awaitingconfirmation`.
- `address` (object): The delivery address, e.g. `{"name": "John Doe", "address": "Sneglevej 78\n6000 Kolding", "country": "DK"}`. Included if filled in.
  - `name` (string): The name on the delivery address.
  - `company` (string): The company name on the delivery address.
  - `address` (string): The full address except name and country, e.g. `Sneglevej 78\n6000 Kolding`.
  - `country` (string): The two-letter country code, e.g. `DK`.
- `billing_address` (object): The billing address, e.g. `{"company": "Business Corp", "address": "Business road 56\n4637 Town", "country": "NO"}`. Included if the order has one.
  - `name` (string): The name on the billing address.
  - `company` (string): The company name on the billing address.
  - `address` (string): The full address except name and country.
  - `country` (string): The two-letter country code, e.g. `NO`.
- `email` (string): The email address filled in on the order, e.g. `johndoe@example.com`. Included if set.
- `billing_email` (string): The billing email address, e.g. `billing@example.com`. Included if set.
- `note` (string): A note left on the order, e.g. `Gift wrapped please`. Included if set.
- `ip` (string): IP address that placed the order, e.g. `123.123.123.123`. Included if set.
- `password` (string): Hashed password set up for the customer during ordering, e.g. `pbkdf2_sha256$870000$Rk3mXw9b8pQ0$gB5nC2fJqZ1sH7dLmP0tV4aE6wN8uY3rT5cK9`. Included if a password was chosen.
- `customer_id` (string): Customer ID of the customer attached to the order, if any, e.g. `452`. This is also returned as `customer` for backwards compatibility.
- `subscription_date_begin` (date): When the subscription begins, as `YYYY-MM-DD`, e.g. `2026-12-24`. Included if a date was chosen.
- `payment_agreement` (object): The payment agreement chosen, e.g. `{"id": "7453106", "text": "Mastercard: XX...XX2451"}`. Included if a payment agreement was used.
  - `id` (string): ID of the payment agreement.
  - `text` (string): The payment agreement text, e.g. `Mastercard: XX...XX2451`.
- `ordering_code` (string): The ordering code applied to the order, e.g. `EXTRA20OFF`. Included if one was used.
- `subscriptions` (array): IDs of the subscriptions created from this order, e.g. `["56469"]`. Included if any were created.

Any fields set up on the order form and filled in on the order, e.g. a newsletter checkbox, are also returned under their field key.

```http
GET /api/orders/?customer=452&created_after=2026-08-24
```

```json
{
   "orders": [
     {
       "id": "83529",
       "created": "2026-09-24T04:18:46",
       "ordering_form": "3-months",    // URL ID of form used for order
       "resume_ordering_url": "https://app.iteras.dk/example/iframe/order/myOrderingForm/?order=vnt3eb683b4833v8", // link to order (only present if status is 'awaitingconfirmation')
       "address": {
          "name": "John Doe",
          "address": "Sneglevej 78\n6000 Kolding",
          "country": "DK"
       },
       "email": "johndoe@example.com",
       "billing_address": {
         "company": "Business Corp",
         "address": "Business road 56\n4637 Town",
         "country": "NO"
       },
       "password": "pbkdf2_sha256$870000$Rk3mXw9b8pQ0$gB5nC2fJqZ1sH7dLmP0tV4aE6wN8uY3rT5cK9", // hashed value
       ":Receive newsletter": true,
       "ip": "123.123.123.123",         // IP address that placed the order
       "ordering_code": "EXTRA20OFF",   // if an ordering code was used
       "products": [                    // chosen products
         {
           "campaign_id": "3months",    // ID of campaign product
           "campaign_name": "3 months",
           "campaign_customer_facing_name": "3 months",
           "text": "3 months (100,00 DKK)", // product text used when ordering
           "quantity": 1,
           "subscribed_to": [{
                "name": "Example subscription product",
                "external_id": "example_product"
            }],
           "price": 100.00,
           "currency": "DKK"
         },
         {
           "name": "Standard size book",           // stand-alone product
           "customer_facing_name": "A good book",
           "external_id": "book_offer_34",
           "text": "A good book at a good price (50,00 DKK)", // product text used when ordering
           ":Custom product field": "Example text",
           "price": 50.00,
           "currency": "DKK"
       ],
       "status": "approved", // or awaitingconfirmation/awaitingpaymentprocessor/awaitingemailconfirmation/awaitingapproval/denied
       "customer_id": "452", // customer ID of customer attached to this order (if any)
       "payment_agreement": {
         "id": "7453106",
         "text": "Mastercard: XX...XX2451 (11/2028)"
       },
       "subscriptions" [  // ID's of created subscriptions from this order (if any)
          "56469"
       ]
     }
   ]
 }
```

## Errors

A `customer` or `order_id` that does not exist returns a plain text HTTP 404 error. A malformed parameter, e.g. a `created_after` that isn't a date, returns a plain text HTTP 400 error that names the parameter.