---
updatedAt: 2026-05-12T23:17:05.000Z
agentTools:
  projectIndex: https://docs.shipscience.com/llms.txt
---

# Ingest a webhook event

Accepts a shipment or label event from an integration partner.

## Authentication
- URL path: opaque per-credential `webhook_api_key`. We mint this for
  you; treat it as semi-public (it identifies your credential but is
  not a secret on its own — HMAC over the body is the cryptographic auth).
- Body: HMAC-SHA256 over the raw request body, base64-encoded. Send
  it in the signature header required by your configured adapter:
  - **Conformant default adapter** — `X-ShipScience-Signature`.
  - **Partner native adapter** — uses its own signature header;
    refer to your partner's documentation for the exact name.
  The server verifies only the header for your credential's adapter;
  a missing or invalid signature returns `401`.

## Request body
The body shape depends on the adapter configured on your credential:
- **Conformant adapter** — JSON envelope `{ event_id, event_type,
  occurred_at, data }` (see `webhook_envelope_shipment`). Send this
  shape unless you have a partner native adapter.
- **Partner native adapter** — send your provider's webhook payload
  as-is (see `webhook_envelope_partner_native`); ShipScience maps
  the fields per-credential. Refer to your partner's documentation
  for the authoritative schema. The conformant envelope is **not**
  accepted by a native-adapter credential.
Sending the wrong shape for your adapter returns `422`.

## Idempotency
- Same `event_id` = same event. Resending is a no-op (we respond 200).
- We accept the same event_id forever; safe to retry indefinitely.
- Do not back off on 200 responses for "duplicate" — they are accepted.

## Retry & timing
- We respond <500 ms typical, <2 s worst case.
- 2xx = accepted, will be processed; 4xx = don't retry; 5xx = retry with backoff.


# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Shipscience API",
    "version": "v1",
    "description": "ShipScience's REST API for partners and customers.\n\n## Authentication\n\nMost endpoints require a bearer JWT in the `Authorization` header. Tokens\nare issued by the ShipScience login flow and are valid for 4 hours.\nClients are responsible for refreshing tokens before expiry. The\n`/api/v1/tokens` endpoint is an exception — it authenticates with the\n`api-key` header rather than a bearer JWT, since its purpose is to\nissue the JWT itself.\n\n## Partner endpoints\n\nThe **Sub Accounts** section is only available to accounts explicitly\nenabled as partners. If you receive `403 Forbidden`, contact\n**support@shipscience.com** to request access.\n"
  },
  "tags": [
    {
      "name": "Webhooks",
      "description": "Inbound webhook ingestion. Accepts shipment + label events from\nintegration partners.\n\nEach ShipScience sub-account has its own dedicated webhook URL,\nreturned in the `webhook_url` field of the `POST /api/v1/sub_accounts`\nresponse. One URL maps to exactly one ShipScience account, so events\nposted to a sub-account URL are routed to that sub-account directly —\nthere is no payload-level account routing.\n\nSee the per-endpoint description for the envelope shape, auth, and\nidempotency contract.\n"
    }
  ],
  "paths": {
    "/webhooks/v1/ingest/{webhook_api_key}": {
      "post": {
        "summary": "Ingest a webhook event",
        "tags": [
          "Webhooks"
        ],
        "description": "Accepts a shipment or label event from an integration partner.\n\n## Authentication\n- URL path: opaque per-credential `webhook_api_key`. We mint this for\n  you; treat it as semi-public (it identifies your credential but is\n  not a secret on its own — HMAC over the body is the cryptographic auth).\n- Body: HMAC-SHA256 over the raw request body, base64-encoded. Send\n  it in the signature header required by your configured adapter:\n  - **Conformant default adapter** — `X-ShipScience-Signature`.\n  - **Partner native adapter** — uses its own signature header;\n    refer to your partner's documentation for the exact name.\n  The server verifies only the header for your credential's adapter;\n  a missing or invalid signature returns `401`.\n\n## Request body\nThe body shape depends on the adapter configured on your credential:\n- **Conformant adapter** — JSON envelope `{ event_id, event_type,\n  occurred_at, data }` (see `webhook_envelope_shipment`). Send this\n  shape unless you have a partner native adapter.\n- **Partner native adapter** — send your provider's webhook payload\n  as-is (see `webhook_envelope_partner_native`); ShipScience maps\n  the fields per-credential. Refer to your partner's documentation\n  for the authoritative schema. The conformant envelope is **not**\n  accepted by a native-adapter credential.\nSending the wrong shape for your adapter returns `422`.\n\n## Idempotency\n- Same `event_id` = same event. Resending is a no-op (we respond 200).\n- We accept the same event_id forever; safe to retry indefinitely.\n- Do not back off on 200 responses for \"duplicate\" — they are accepted.\n\n## Retry & timing\n- We respond <500 ms typical, <2 s worst case.\n- 2xx = accepted, will be processed; 4xx = don't retry; 5xx = retry with backoff.\n",
        "parameters": [
          {
            "name": "webhook_api_key",
            "in": "path",
            "required": true,
            "description": "Per-credential opaque token. Provided to you at onboarding.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-ShipScience-Signature",
            "in": "header",
            "required": false,
            "description": "Base64-encoded HMAC-SHA256 over the raw request body. Send for the conformant default adapter. Partner native adapters use their own signature header — see endpoint description.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Event accepted."
          },
          "401": {
            "description": "Unknown webhook_api_key OR invalid signature."
          },
          "422": {
            "description": "Malformed body, missing event_id, or unsupported event_type."
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/webhook_envelope_shipment"
                  },
                  {
                    "$ref": "#/components/schemas/webhook_envelope_partner_native"
                  }
                ]
              }
            }
          },
          "required": true
        }
      }
    }
  },
  "components": {
    "schemas": {
      "webhook_address": {
        "type": "object",
        "nullable": true,
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "company": {
            "type": "string",
            "nullable": true
          },
          "address1": {
            "type": "string",
            "nullable": true
          },
          "address2": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "zip": {
            "type": "string",
            "nullable": true
          },
          "country_code": {
            "type": "string",
            "nullable": true,
            "example": "US"
          }
        }
      },
      "webhook_data_shipment": {
        "type": "object",
        "description": "The shipment payload. Identify the manifest shipment with one of:\n`api_id` (ours, returned from a prior webhook), `external_id`\n(yours, partner-supplied), or `tracking_number`. On update, send\none of those plus the fields you want to change. Omitted fields\npreserve their existing value; explicit nulls null the column.\n\n`items` is the COMPLETE current state of items on this manifest:\nitems present in a previous payload but absent here are deleted\nautomatically. Each item must be identified by **either** `api_id`\n(ours, returned on a prior webhook) **or** `external_id` (yours);\nan item without either cannot be reconciled and is rejected.\n\nItem updates are partial: an item identified by `api_id`/`external_id`\nthat omits `title`, `sku`, etc. preserves the existing values. New\nitems (no matching `api_id`/`external_id`) require `title` so we\nhave something to persist as `item_description`.\n\n`order_number` must be present on the manifest at the moment items\nare reconciled — either supplied in this payload or already\npersisted from a prior payload. A payload that introduces items on\na manifest with no prior `order_number` and no `order_number` in\nthe current body will be rejected.\n",
        "properties": {
          "api_id": {
            "type": "string",
            "example": "mns_abc123",
            "nullable": true,
            "description": "Our identifier, returned from a prior shipment.created webhook."
          },
          "external_id": {
            "type": "string",
            "example": "order-42",
            "nullable": true,
            "description": "Your identifier. Recommended for the first webhook on a manifest."
          },
          "tracking_number": {
            "type": "string",
            "example": "1Z999AA10123456784",
            "nullable": true,
            "description": "Required if neither api_id nor external_id is supplied."
          },
          "carrier": {
            "type": "string",
            "example": "UPS",
            "nullable": true
          },
          "order_number": {
            "type": "string",
            "nullable": true,
            "description": "Required on the manifest (in this payload or persisted from a prior payload) when `items` is provided."
          },
          "service": {
            "type": "string",
            "nullable": true
          },
          "from_address": {
            "$ref": "#/components/schemas/webhook_address"
          },
          "to_address": {
            "$ref": "#/components/schemas/webhook_address"
          },
          "items": {
            "type": "array",
            "description": "Complete current state of items. Items absent from a later payload are deleted. Each item must include at least one of `api_id` or `external_id`.",
            "items": {
              "type": "object",
              "description": "Either `api_id` or `external_id` is required to identify the item. `title` is required only when creating a new item; on updates it is optional and preserves the existing value.",
              "anyOf": [
                {
                  "required": [
                    "api_id"
                  ]
                },
                {
                  "required": [
                    "external_id"
                  ]
                }
              ],
              "properties": {
                "api_id": {
                  "type": "string",
                  "example": "mnsi_xyz",
                  "description": "Our item identifier, returned from a prior webhook. Omit the key if you do not have one yet (do not send null)."
                },
                "external_id": {
                  "type": "string",
                  "example": "li_1",
                  "description": "Your item identifier. Required when api_id is not provided. Omit the key if not applicable (do not send null)."
                },
                "sku": {
                  "type": "string",
                  "example": "SKU1",
                  "nullable": true
                },
                "title": {
                  "type": "string",
                  "example": "Hat",
                  "nullable": true,
                  "description": "Persisted as item_description. Required when creating a new item; optional on updates (omitted = preserve existing)."
                },
                "quantity": {
                  "type": "integer",
                  "example": 2
                },
                "price": {
                  "type": "string",
                  "example": "12.50",
                  "nullable": true
                }
              }
            }
          }
        }
      },
      "webhook_envelope_shipment": {
        "type": "object",
        "description": "Conformant adapter envelope. This is the shape ShipScience expects\nfor credentials configured with the default (\"Conformant\") adapter.\nPartner native adapters use their own provider-specific shape —\nsee `webhook_envelope_partner_native` and the per-adapter section\nin the endpoint description.\n",
        "required": [
          "event_id",
          "event_type",
          "occurred_at",
          "data"
        ],
        "properties": {
          "event_id": {
            "type": "string",
            "example": "evt_abc123",
            "description": "Unique per event. Used for idempotency — resending the same event_id is a no-op."
          },
          "event_type": {
            "type": "string",
            "enum": [
              "shipment.created",
              "shipment.updated"
            ],
            "example": "shipment.created"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time",
            "example": "2026-05-05T18:00:00Z"
          },
          "data": {
            "$ref": "#/components/schemas/webhook_data_shipment"
          }
        }
      },
      "webhook_envelope_partner_native": {
        "type": "object",
        "description": "Partner native adapter payload. The body shape matches your\nprovider's webhook contract — refer to your partner's\ndocumentation for the authoritative schema. ShipScience maps\nthe fields per-credential, and the adapter validates the\nsignature using its own header (not `X-ShipScience-Signature`).\n\nSend this shape ONLY for credentials configured with a partner\nnative adapter; the conformant envelope is rejected as 422 by a\nnative-adapter credential. Fields are intentionally undeclared\nhere — the runtime adapter is the authoritative parser.\n"
      }
    }
  },
  "servers": [
    {
      "url": "https://app.shipscience.com",
      "variables": {
        "defaultHost": {
          "default": "app.shipscience.com"
        }
      }
    }
  ]
}
```