Creating an Order

Step-by-step guide to creating an order through the Presscart API, from browsing products to checkout.

This guide walks through the complete flow for placing an order via the Presscart API.

Prerequisites

Your API token needs the following scopes:

  • products.read -- to browse the marketplace
  • profiles.lists -- to look up your profile ID
  • orders.create -- to place the order

Step 1: Get your profile ID

List the profiles on your team to find the profile you want to place the order for.

curl "https://api.presscart.com/teams/YOUR_TEAM_ID/profiles" \
  -H "Authorization: Bearer $PRESSCART_API_TOKEN"

Note the id of the profile you want to use.

Step 2: Browse the marketplace

Search for products using the listings endpoint.

curl "https://api.presscart.com/products/listings?limit=20&filters[is_do_follow]=true" \
  -H "Authorization: Bearer $PRESSCART_API_TOKEN"

You can filter by channel type, placement type, price range, Domain Authority, Domain Rating, turnaround time, tags, location, and more. See the Products API reference for all available filters.

Step 3: Review product details

Once you find a product you are interested in, retrieve its full details.

curl "https://api.presscart.com/products/33333333-3333-3333-3333-333333333333" \
  -H "Authorization: Bearer $PRESSCART_API_TOKEN"

Step 4: Place the order

Submit a checkout request with your profile ID and line items. An API token never pays from Team Credits unless a person has given it a spend grant; without one, the order is created and waits at its checkout link (step 5) for a person to pay.

curl -X POST "https://api.presscart.com/orders/checkout" \
  -H "Authorization: Bearer $PRESSCART_API_TOKEN" \
  -H "Idempotency-Key: 6f0c1d2e-3b4a-4c5d-8e9f-0a1b2c3d4e5f" \
  -H "Content-Type: application/json" \
  -d '{
    "profile_id": "22222222-2222-2222-2222-222222222222",
    "line_items": [
      {
        "product_id": "33333333-3333-3333-3333-333333333333",
        "quantity": 1,
        "is_add_on": false,
        "linked_order_line_item_id": null
      }
    ]
  }'

Retrying safely

Generate one unique Idempotency-Key per order you intend to create (a UUID works well) and send it on the first attempt and on every retry. If a request times out or the connection drops, you cannot know whether the order was created. Repeat the exact same request with the same key:

  • If the first attempt succeeded, you get the original response back with the header Idempotent-Replayed: true, and no second order is created.
  • If the first attempt is still running, you get 409 (idempotency_key_in_flight). Wait a moment and retry with the same key.
  • If the first attempt created the order but failed afterwards, the retry returns that order as it is now, with Idempotent-Replayed: true. No second order is created.
  • If the first attempt failed before creating an order, the key is released and the retry is processed as a new attempt.
  • If you reuse a key with a different body, you get 422 (idempotency_key_reused) and nothing is created. Use a new key for a new order.

The header is optional. Without it, a repeated request creates another order, so do not blindly retry requests that carry no key. Keys are kept for at least 24 hours and apply only to your team. See Create order for details.

Line item fields

FieldTypeDescription
product_idstringUUID of the product to order
quantitynumberHow many units to order
is_add_onbooleanSet to true if this is an add-on to another item
linked_order_line_item_idstring | nullFor add-ons, the UUID of the parent line item. null for primary items

Adding add-ons

To include add-on products, add a second line item with is_add_on: true and reference the parent item:

{
  "profile_id": "22222222-2222-2222-2222-222222222222",
  "line_items": [
    {
      "product_id": "33333333-3333-3333-3333-333333333333",
      "quantity": 1,
      "is_add_on": false,
      "linked_order_line_item_id": null
    },
    {
      "product_id": "77777777-7777-7777-7777-777777777777",
      "quantity": 1,
      "is_add_on": true,
      "linked_order_line_item_id": null
    }
  ]
}

The response includes a checkout_link field — a URL you can share with the customer so they can complete payment in their browser.

Step 6: Verify the order

Retrieve the order to confirm it was created successfully.

curl "https://api.presscart.com/orders/ORDER_ID" \
  -H "Authorization: Bearer $PRESSCART_API_TOKEN"

Next steps

On this page