# Spoke Connect API Docs

> Learn how to integrate your systems with the Spoke Connect programmatic API

- API Reference: Every endpoint, request, and response.
  - [Spoke Connect API](/api)
  - Using the API
    - [Using the API](/api/using-the-api): Base address, authentication, ids, pagination, edits, and rate limits.
    - [Address](/api/using-the-api/address): The base address every request goes to, over HTTPS only.
    - [Your first request](/api/using-the-api/your-first-request): List your orders with a single authenticated request.
    - [Authentication](/api/using-the-api/authentication): Create API keys in Connect and send them as Bearer or Basic credentials.
    - [On resource types](/api/using-the-api/on-resource-types): The four resources the API returns, and which of them you can write.
    - [On resource IDs](/api/using-the-api/on-resource-ids): How prefixed ids such as orders/{id} address a resource.
    - [On List endpoints](/api/using-the-api/on-list-endpoints): Page through a collection with maxPageSize and nextPageToken.
    - [On Update endpoints (HTTP PATCH verb)](/api/using-the-api/on-update-endpoints-http-patch-verb): How PATCH treats omitted fields, null, arrays, and addresses.
    - [On Rate-Limiting](/api/using-the-api/on-rate-limiting): Per-IP limits for reads, writes, and batches, and how to back off.
    - [On the models](/api/using-the-api/on-the-models): Where each resource is documented field by field.

  - **Endpoints**
  - Orders: Create, submit, and track delivery orders, and download their printable PDF labels.
    - [Orders](/api/orders): Create, submit, and track delivery orders, and download their printable PDF labels.
    - [List orders](/api/orders/listOrders): List the authenticated retailer's orders, newest first. Supports cursor pagination and an exact-match filter on `packageInfo.externalId`.
    - [Create an order](/api/orders/createOrder): Create a new order for the authenticated retailer.
    - [Batch import orders](/api/orders/importOrders): Create up to 100 orders for the authenticated retailer in one request. Always returns `200`; per-item outcomes are split across `success` and `failed`.
    - [Batch submit orders](/api/orders/submitOrders): Submit up to 100 draft orders to a connected courier in one request. Submitted orders are picked up at the pickup location (or shipped to the courier) and delivered from the courier's depot. Always returns `200` when the courier is valid; per-order outcomes are split across `success` and `failed`.
    - [Batch withdraw orders](/api/orders/withdrawOrders): Withdraw up to 100 submitted orders back to draft in one request. An order that has already been added to a route can no longer be withdrawn. Always returns `200`; per-order outcomes are split across `success` and `failed`.
    - [Retrieve an order](/api/orders/getOrder): Retrieve a single order for the authenticated retailer.
    - [Edit an order](/api/orders/updateOrder): Edit an order for the authenticated retailer. An omitted field is left unchanged, an explicit `null` clears a nullable field, an empty nested object changes nothing, and arrays replace the whole stored array. A provided address replaces the stored address in full and is re-geocoded exactly as on create. A read-only order (added by the courier, or already on a route) cannot be edited.
    - [Delete an order](/api/orders/deleteOrder): Delete an order for the authenticated retailer. Only a draft order can be deleted: a submitted order must be withdrawn first, and a read-only order (added by the courier, or already on a route) cannot be deleted.
    - [Retrieve an order's shipping labels](/api/orders/getOrderShippingLabels): Render the order's shipping labels as a single PDF (A6, one Code 128 barcode per page, one page per package) and return a signed URL to it, valid for one hour. Every call renders the labels afresh and signs a new URL, so fetch it promptly server-side: the link is too short-lived to embed anywhere a recipient might open later.
  - Couriers: Look up the couriers that deliver your orders.
    - [Couriers](/api/couriers): Look up the couriers that deliver your orders.
    - [List couriers](/api/couriers/listCouriers): List the couriers connected to the authenticated retailer.
    - [Retrieve a courier](/api/couriers/getCourier): Retrieve a single courier connected to the authenticated retailer.
  - Pickup Locations: Look up the pickup locations your orders ship from.
    - [Pickup Locations](/api/pickup-locations): Look up the pickup locations your orders ship from.
    - [List pickup locations](/api/pickup-locations/listPickupLocations): List the authenticated retailer's pickup locations.
    - [Retrieve a pickup location](/api/pickup-locations/getPickupLocation): Retrieve a single one of the authenticated retailer's pickup locations.
- Guides
  - Usage Examples: Walkthroughs of common integration flows.
    - [Usage Examples](/docs/api-examples)
    - [Create an order](/docs/api-examples/create-an-order): Create a draft order with a single request, sending just an address to start.
    - [Bulk-import orders](/docs/api-examples/bulk-import-orders): Create up to 100 orders in one request, then read back what failed.
    - [Submit an order, and withdraw it](/docs/api-examples/submit-and-withdraw-an-order): Hand a draft order to a courier, and pull it back before it is routed.
    - [Download a printable label](/docs/api-examples/download-shipping-labels): Fetch a short-lived signed link to an order's printable label PDF.
    - [List orders and follow their progress](/docs/api-examples/track-orders): List orders and follow delivery progress and ETAs as they update.
  - Webhooks: Notifications we send as your orders progress.
    - [Spoke Connect Webhook API](/docs/webhooks/webhook-api-intro): Receive a signed call at your own URL when one of your orders is scheduled, goes out for delivery, gets a tracking link, or has a delivery attempt.
    - [Getting started with the Spoke Connect Webhook API](/docs/webhooks/enabling): Prepare your endpoint, then enable webhooks and select events in Connect, and send a test event.
    - Getting Started
      - [Implementing the Endpoint](/docs/webhooks/getting-started/consuming-the-webhook-notifications): A minimal webhook handler in Node and Python that reads the raw body and answers with a 2xx.
      - [Securing the Endpoint](/docs/webhooks/getting-started/securing-the-endpoint): Check the spoke-signature header, a hex HMAC-SHA256 of the request body, to confirm a webhook came from Spoke.
      - [Best Practices](/docs/webhooks/getting-started/best-practices): How Spoke delivers webhooks (at least once, unordered, with retries) and how to write a handler that de-duplicates events and reads the order's latest state.
    - [Webhook Events](/docs/webhooks/webhook-events): The order events Spoke sends, when it sends each one, and the message body they share.
  - Models: What each resource and field means.
    - [Models](/docs/models)
    - [Order](/docs/models/order): A package, or set of packages, you are sending to a recipient.
    - [Courier](/docs/models/courier): A courier your account is connected to and can submit orders to.
    - [PickupLocation](/docs/models/pickup-location): One of your own locations a courier can collect from.
    - [OrderShippingLabels](/docs/models/shipping-labels): A short-lived link to an order's printable label PDF.
- About the API: Versioning policy and changelog.
  - [API Versioning](/versioning)
  - [API Changelog](/changelog)

## When to use

The Connect API is how a retailer creates, tracks, and hands off its deliveries in Spoke programmatically. Use it to create, edit, delete, list, and retrieve orders, submit them to a courier and withdraw them before they ship, and download printable PDF labels. Webhooks notify you as your orders progress.

Use it to integrate a retailer's own systems with Spoke Connect. Call it over HTTPS at `https://api.spoke.com/connect/v1` with an API key in the `Authorization: Bearer <api-key>` header ([Authentication](/api/using-the-api/authentication)). Spoke has no SDKs: call the endpoints directly or generate a client from the OpenAPI spec.

## OpenAPI and MCP

- [OpenAPI spec (v1)](/openapi.json): the full Connect API description, for generating clients.
- [MCP server](/mcp): search and read these docs over MCP (streamable HTTP).
