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

# ACP API Endpoints

> Order submission endpoints and request patterns.

# ACP API Endpoints

ACP exposes endpoints for synchronous, async, and batch order submission.

## Endpoints

| Method | Endpoint                                   | Description                 |
| ------ | ------------------------------------------ | --------------------------- |
| POST   | `/v1/tenants/{tenant_id}/acp/orders`       | Process order synchronously |
| POST   | `/v1/tenants/{tenant_id}/acp/orders/async` | Process order in background |
| POST   | `/v1/tenants/{tenant_id}/acp/orders/batch` | Process multiple orders     |

## Authentication

Use either header for API key authentication:

```
Authorization: Bearer your-api-key-here
```

```
X-API-Key: your-api-key-here
```

## Example: Basic Order Submission

```bash theme={null}
curl -X POST https://your-server.com/v1/tenants/{tenant_id}/acp/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "orderId": "agent-order-001",
    "orderNumber": "ORD-1001",
    "customer": {
      "email": "customer@example.com",
      "firstName": "John",
      "lastName": "Doe"
    },
    "shippingAddress": {
      "name": "John Doe",
      "address1": "123 Main Street",
      "city": "San Francisco",
      "state": "CA",
      "postalCode": "94102",
      "countryCode": "US"
    },
    "lineItems": [
      {
        "sku": "WIDGET-001",
        "title": "Blue Widget",
        "quantity": 2,
        "price": 29.99
      }
    ]
  }'
```

## Which one to use

| Situation                                    | Endpoint                                                                   |
| -------------------------------------------- | -------------------------------------------------------------------------- |
| Interactive checkout — a customer is waiting | **Sync.** The response tells you immediately whether every target accepted |
| High volume, or a slow downstream (ERP)      | **Async.** Get a job ID back in milliseconds, poll for the result          |
| Backfill or migration                        | **Batch.** One request, many orders, per-order results                     |

<Warning>
  All three run the same fan-out, so all three can **partially succeed** — NetSuite accepts while
  fulfillment rejects. Whatever endpoint you use, read the per-target results rather than a top-level
  success flag.
</Warning>

## Example

```bash theme={null}
curl -X POST https://your-server.com/v1/tenants/tnt_42/acp/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: src_88213" \
  -d @order.json
```

Use your source order ID as the `Idempotency-Key` — a retried submission then replays the original
result instead of creating a duplicate downstream.

## Related

* [ACP schemas](/stateset-acp/stateset-acp-schemas) — the full order object, with a worked example
* [Async processing](/stateset-acp/stateset-acp-async-processing) — job lifecycle and polling
* [Deploy an ACP handler](/stateset-deploy-acp-handler)
