# Webhooks overview

Webhooks push events from the Tranztec Platform to a URL you control, so you do not have to poll. You register them per partner, either on **one object** (a specific load, tractor or driver) or on an **object type** (every load the partnership shares, now and in future).

## Event types

| `type` | Fires when | Object types |
|---|---|---|
| `update` | The object's fields change | any |
| `archive` | The object is archived (an order is cancelled or completed and filed) | any |
| `gps` | A new position is recorded | `driver`, `truck`, `trailer`, `order`, `segment` |
| `hos` | A driver's duty status changes | `driver` |
| `arrive` | A stop is arrived | `order`, `segment` |
| `depart` | A stop is departed | `order`, `segment` |
| `truckperformance` | A performance summary arrives from the ELD | `truck` |

Object types: `order` (customer orders), `segment` (carrier loads), `driver`, `truck`, `trailer`, `carrier`. See [Resources and identifiers](/docs/concepts/resources-and-identifiers) for the order-versus-load distinction.

## Register on one object

```bash
curl -X POST "https://carriercloud.ai/v1/webhooks/MIST/register/" \
  -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{ "type": "arrive", "cardid": "Tyc24gHSx2SHShYma", "url": "https://hooks.example.com/carriercloud" }'
```

```json
{ "_id": "wh-6f2a1c9d" }
```

`cardid` is the object's identifier (a `loadid`, `tractorguid`, `driverid`). Registering the same object, type and URL twice answers `422 Webhook already exists`.

## Register on an object type

```bash
curl -X POST "https://carriercloud.ai/v1/webhooks/MIST/type/register/" \
  -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{ "type": "gps", "cardtype": "truck", "url": "https://hooks.example.com/carriercloud/gps" }'
```

Answers `204`. The subscription is attached to every board the partnership shares for that type and is copied onto objects created later, so new trucks report positions without a new registration. Registering the same subscription again is ignored.

## Remove subscriptions

```bash
# one object
curl -X DELETE "https://carriercloud.ai/v1/webhooks/MIST/Tyc24gHSx2SHShYma/update" -H "Authorization: Bearer YOUR_API_KEY"
# an object type
curl -X DELETE "https://carriercloud.ai/v1/webhooks/MIST/type/truck/gps" -H "Authorization: Bearer YOUR_API_KEY"
```

Both answer `204`.

:::warning
Object-level removal accepts only `update`, `archive`, `gps` and `hos`; an object-level `arrive`, `depart` or `truckperformance` registration answers `422 Invalid type` on removal. Register those three at the type level if you expect to turn them off.
:::

## Choosing between object and type

| Use object-level when | Use type-level when |
|---|---|
| You care about specific loads for their lifetime (a shipper following its own orders) | You want everything the partnership shares (a visibility provider, a fleet dashboard) |
| You want to stop receiving events when the load is done | You want new objects covered automatically |

Next: [Event payloads](/docs/webhooks/events) and [Delivery, retries and security](/docs/webhooks/delivery).
