# Create a carrier

> POST /api/public/v1/carriers, scope directory.write. Techvia TMS public API v1 reference.

Source: https://techvia.software/docs/tms/reference/carriers/create-a-carrier/

`POST /api/public/v1/carriers`

**Scope:** `directory.write`. **MCP tool:** `create_carrier`. Rules and edge cases: [Carriers guide](/docs/tms/guides/directory/).

## Request body

Content type `application/json`. Limits and rules for each field are in the [Carriers guide](/docs/tms/guides/directory/).

| Field | Type | Required | Notes |
|---|---|---|---|
| `name` | string | no |  |
| `dotNumber` | string | no |  |
| `mcNumber` | string | no |  |
| `scac` | string | no |  |
| `contactName` | string | no |  |
| `phone` | string | no |  |
| `email` | string | no |  |
| `liabilityExpiry` | string (date) | no |  |
| `autoExpiry` | string (date) | no |  |
| `cargoExpiry` | string (date) | no |  |

## Responses

| Status | Meaning | Body |
|---|---|---|
| `201` | Created | `PublicCarrier` |
| `409` | Conflict | `ProblemDetails` |
| `422` | Unprocessable Entity | `ProblemDetails` |

### `201` body

| Field | Type | Notes |
|---|---|---|
| `id` | string (uuid) |  |
| `name` | string |  |
| `mcNumber` | string |  |
| `dotNumber` | string |  |
| `status` | enum CarrierStatus | One of `Active`, `Inactive` |
| `insuranceExpiry` | string (date) |  |
| `phone` | string |  |
| `email` | string |  |
| `scac` | string |  |
| `rowVersion` | integer |  |

Errors are RFC 7807 problem details; see [Errors](/docs/tms/concepts/errors/).

**Example request**

**curl**

```bash
curl -X POST "https://tms-api.techvia.software/api/public/v1/carriers" \
  -H "Authorization: Bearer $TMS_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "name": "Ironhorse Transport",
    "dotNumber": "2841937",
    "mcNumber": "992344",
    "scac": "IRHT",
    "contactName": "Mark Bell",
    "phone": "214-555-0188",
    "email": "dispatch@ironhorse.example",
    "liabilityExpiry": "2027-03-31",
    "autoExpiry": "2027-03-31",
    "cargoExpiry": "2027-06-30"
  }'
```

**JavaScript**

```js
const res = await fetch(`https://tms-api.techvia.software/api/public/v1/carriers`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.TMS_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    "name": "Ironhorse Transport",
    "dotNumber": "2841937",
    "mcNumber": "992344",
    "scac": "IRHT",
    "contactName": "Mark Bell",
    "phone": "214-555-0188",
    "email": "dispatch@ironhorse.example",
    "liabilityExpiry": "2027-03-31",
    "autoExpiry": "2027-03-31",
    "cargoExpiry": "2027-06-30"
  }),
});
if (!res.ok) throw new Error(await res.text());
console.log(await res.json());
```

**Python**

```python

res = requests.request(
    "POST",
    f"https://tms-api.techvia.software/api/public/v1/carriers",
    headers={"Authorization": f"Bearer {os.environ['TMS_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
    json={
      "name": "Ironhorse Transport",
      "dotNumber": "2841937",
      "mcNumber": "992344",
      "scac": "IRHT",
      "contactName": "Mark Bell",
      "phone": "214-555-0188",
      "email": "dispatch@ironhorse.example",
      "liabilityExpiry": "2027-03-31",
      "autoExpiry": "2027-03-31",
      "cargoExpiry": "2027-06-30"
    },
)
res.raise_for_status()
print(res.json())
```

**Example response** `201`

```json
{
  "id": "01a20943-7a10-7c11-8a2e-000000000040",
  "name": "Ironhorse Transport",
  "mcNumber": "992344",
  "dotNumber": "2841937",
  "status": "Active",
  "insuranceExpiry": "2027-03-31",
  "phone": "214-555-0188",
  "email": "dispatch@ironhorse.example",
  "scac": "IRHT",
  "rowVersion": 512
}
```

<p class="ep-caption">Illustrative values. <code>insuranceExpiry</code> is the earliest of the liability, auto and cargo expiries.</p>
