# Create or extend a delivery

`POST https://{domain}/api/v2/third/delivery`

Operation ID: `deliveries.upsert` · API v2

Makes sure a delivery of the gateway listens to the given product IDs. When a delivery already has one of the IDs, the missing ones are added to it (its name and type do not change). When none has them, a new delivery is created. An ID that belongs to a different delivery is refused.

The delivery is nested twice: `data.data`.

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `external_id` | string | yes | Gateway product IDs, separated by commas. |
| `name` | string | yes | Name of a new delivery. An existing delivery keeps its name. |
| `provider` | string | yes | Gateway key, from the Cademí gateway catalog. |
| `type` | string, one of `single`, `recurrence` | yes | single for one-time sales, recurrence for subscriptions. |

## Responses

### 200

The delivery.

Body: object.

### 401

The Authorization header is missing, or the key does not exist or was deleted.

Body: HandlerError.

### 409

data.data is external_id in use in the v2 envelope, or a validation problem in the shorter error body.

Body: Error or HandlerError.

Full schema: https://cademi.dev/openapi/v2.json
