> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tryenvoy.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.tryenvoy.ai/_mcp/server.

# Batch create carriers

POST https://tryenvoy.ai/api/v1/carriers/batch
Content-Type: application/json

Batch create or update carriers. Accepts API-key or session/bearer auth so both integrations and the web app (CSV upload) can call it.

**Authentication:** Supports API key and bearer token authentication.

Reference: https://docs.tryenvoy.ai/api-reference/endpoints/carriers/batch-create

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://tryenvoy.ai/api/v1` (Production, default)
- `https://staging.tryenvoy.ai/api/v1` (Staging)

## Request

### Headers

- `X-Organization-ID` (string, optional, nullable)
- `Idempotency-Key` (string, optional) — A unique key (up to 255 printable ASCII characters, e.g. a UUID) that makes a retry of this request safe. Envoy stores the response for 24 hours; a retry with the same key and the same request returns it again with `Idempotent-Replayed: true` instead of running twice. The same key with a different request returns 422 `idempotency_key_reused`; while the first request is still running, 409 `idempotency_key_in_progress`. 5xx and 429 responses are not stored.

### Body (application/json)

This endpoint expects a CarrierBatchCreateRequest.

- `carriers` (list of CarrierWithLanesCreateRequest, required) — List of carriers to create (max 1000)

## Response

### 200

Successful Response

- `success` (boolean, required)
- `total` (integer, required)
- `successful` (integer, required)
- `failed` (integer, required)
- `created` (integer, required)
- `updated` (integer, required)
- `results` (list of CarrierBatchResult, required)
- `processed_at` (datetime, required)
- `data` (list of BatchItemResult, optional) — One result per submitted carrier, in request order
- `summary` (BatchSummary, optional, nullable) — Counts by outcome

### 207

Some items were not applied; each one's reason is in data[].error (or errors[])

## Errors

### 401 Unauthorized Error

Not authenticated - missing or invalid token/API key

- `any`

### 403 Forbidden Error

Insufficient permissions for this operation

- `any`

### 409 Conflict Error

`idempotency_key_in_progress`: a request with this Idempotency-Key is still running; retry later

- `any`

### 422 Unprocessable Entity Error

Validation Error; or `idempotency_key_reused`: this Idempotency-Key was already used for a different request

- `detail` (list of ValidationError, optional)

### 429 Too Many Requests Error

Rate limit exceeded - see Retry-After header

- `any`

## Types

### CarrierWithLanesCreateRequest

Request model for creating a carrier via batch ingestion.

- `carrier` (CarrierCreateRequest, required) — Request model for creating a carrier

### CarrierBatchResult

Result for a single carrier in batch operation

- `identifier` (string, required) — Carrier identifier (name or MC#)
- `success` (boolean, required)
- `carrier_id` (string, optional, nullable)
- `operation` (string, optional, nullable)
- `lanes_created` (integer, optional, default: 0)
- `error` (string, optional, nullable)
- `error_code` (string, optional, nullable)

### BatchItemResult

The outcome for one item of a batch request.

- `index` (integer, required) — Position of the item in the request array (0-based)
- `status` (enum, required) — What happened to one submitted item.
  - Allowed values: `created`, `updated`, `skipped`, `failed`
- `id` (string, optional, nullable) — Envoy ID of the created or updated resource (prefixed)
- `external_id` (string, optional, nullable) — The caller's own ID for the item (tms_load_id / tms_carrier_id), echoed back
- `error` (ErrorDetail, optional, nullable) — Why the item failed or was skipped; null when it was created or updated

### BatchSummary

Counts across a batch. ``created + updated + skipped + failed == total``.

- `total` (integer, required)
- `created` (integer, required)
- `updated` (integer, required)
- `skipped` (integer, required)
- `failed` (integer, required)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### CarrierCreateRequest

Request model for creating a carrier

- `name` (string, required) — Carrier company name
- `tms_carrier_id` (string, optional, nullable) — Your TMS's ID for the carrier; Envoy matches updates on it first
- `mc_number` (string, optional, nullable) — MC number
- `dot_number` (string, optional, nullable) — DOT number
- `email` (string, optional, nullable) — Primary email
- `phone` (string, optional, nullable) — Primary phone (any common format, stored as E.164)
- `dispatcher_name` (string, optional, nullable) — Dispatcher name
- `dispatcher_phone` (string, optional, nullable) — Dispatcher phone (any common format, stored as E.164)
- `dispatcher_email` (string, optional, nullable) — Dispatcher email
- `contacts` (list of CarrierContactInput, optional, nullable) — Typed contacts list
- `on_time_delivery_pct` (double, optional, nullable) — On-time delivery percentage (0-100 scale)
- `on_time_pickup_pct` (double, optional, nullable) — On-time pickup percentage (0-100 scale)
- `total_loads_hauled` (integer, optional, nullable) — Total loads hauled
- `is_onboarded` (boolean, optional, default: false) — Whether carrier is onboarded
- `is_active` (boolean, optional, default: true) — Whether the carrier is active. False creates the carrier disabled, or disables it if it already exists (e.g. the source TMS flags it do-not-load). True never re-enables an existing carrier; use the enable endpoint for that.
- `tms_status` (string, optional, nullable) — Carrier status as reported by the source TMS (e.g. DNL). Stored as sent; the latest value wins. Read by the inbound email gate when the organization opts in to operational restriction notices for inactive carriers with this status.
- `equipment_types` (list of enum, optional, nullable) — Equipment types this carrier can haul
  - Allowed values: `VAN`, `REEFER`, `FLATBED`, `STEPDECK`, `RGN`, `CONESTOGA`, `BOX_TRUCK`, `CONTAINER`, `INTERMODAL`, `POWER_ONLY`, `TANKER`, `LOWBOY`, `HOTSHOT`, `AUTO_CARRIER`, `DRY_BULK`, `DRY_TEAM`, `REEFER_TEAM`, `LTL`, `OTHER`, `VAN/REEFER`
- `carrier_rep_name` (string, optional, nullable) — Carrier rep owner full name
- `carrier_rep_email` (string, optional, nullable) — Carrier rep owner email

### ErrorDetail

Structured error detail for v1 API responses. Machine-readable error codes allow clients to switch on error.code instead of parsing human-readable messages. Example response: \{ "error": \{ "code": "offer\_already\_accepted", "message": "Only one offer can be accepted per load.", "param": null } }

- `code` (string, required) — Machine-readable error code (e.g., 'not_found', 'validation_error')
- `message` (string, required) — Human-readable error description
- `param` (string, optional, nullable) — The request parameter that caused the error, if applicable

### ValidationErrorLocItems

### ValidationErrorCtx

### CarrierContactInput

Typed contact entry for carrier ingestion.

- `contact_type` (enum, required)
  - Allowed values: `CARRIER`, `DISPATCHER`, `DRIVER`, `TENDERING`, `QUOTING`, `OTHER`
- `name` (string, optional, nullable) — Contact name
- `phone` (string, optional, nullable) — Contact phone (any common format, stored as E.164)
- `email` (string, optional, nullable) — Contact email
- `equipment_type` (enum, optional, nullable) — Equipment type this contact handles
  - Allowed values: `VAN`, `REEFER`, `FLATBED`, `STEPDECK`, `RGN`, `CONESTOGA`, `BOX_TRUCK`, `CONTAINER`, `INTERMODAL`, `POWER_ONLY`, `TANKER`, `LOWBOY`, `HOTSHOT`, `AUTO_CARRIER`, `DRY_BULK`, `DRY_TEAM`, `REEFER_TEAM`, `LTL`, `OTHER`, `VAN/REEFER`

## Examples

### Example 1

**Request**

```json
{
  "carriers": [
    {
      "carrier": {
        "name": "string"
      }
    }
  ]
}
```

**Response**

```json
{
  "success": true,
  "total": 1,
  "successful": 1,
  "failed": 1,
  "created": 1,
  "updated": 1,
  "results": [
    {
      "identifier": "string",
      "success": true,
      "carrier_id": "string",
      "operation": "string",
      "lanes_created": 0,
      "error": "string",
      "error_code": "string"
    }
  ],
  "processed_at": "2024-01-15T09:30:00Z",
  "data": [
    {
      "index": 1,
      "status": "created",
      "id": "string",
      "external_id": "string",
      "error": {
        "code": "string",
        "message": "string",
        "param": "string"
      }
    }
  ],
  "summary": {
    "total": 1,
    "created": 1,
    "updated": 1,
    "skipped": 1,
    "failed": 1
  }
}
```

**SDK Code**

```python
import requests

url = "https://tryenvoy.ai/api/v1/carriers/batch"

payload = { "carriers": [{ "carrier": { "name": "string" } }] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://tryenvoy.ai/api/v1/carriers/batch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"carriers":[{"carrier":{"name":"string"}}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tryenvoy.ai/api/v1/carriers/batch"

	payload := strings.NewReader("{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://tryenvoy.ai/api/v1/carriers/batch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://tryenvoy.ai/api/v1/carriers/batch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tryenvoy.ai/api/v1/carriers/batch', [
  'body' => '{
  "carriers": [
    {
      "carrier": {
        "name": "string"
      }
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://tryenvoy.ai/api/v1/carriers/batch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["carriers": [["carrier": ["name": "string"]]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://tryenvoy.ai/api/v1/carriers/batch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example 2

**Request**

```json
{
  "carriers": [
    {
      "carrier": {
        "name": "string"
      }
    }
  ]
}
```

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://tryenvoy.ai/api/v1/carriers/batch"

payload = { "carriers": [{ "carrier": { "name": "string" } }] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://tryenvoy.ai/api/v1/carriers/batch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"carriers":[{"carrier":{"name":"string"}}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tryenvoy.ai/api/v1/carriers/batch"

	payload := strings.NewReader("{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://tryenvoy.ai/api/v1/carriers/batch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://tryenvoy.ai/api/v1/carriers/batch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tryenvoy.ai/api/v1/carriers/batch', [
  'body' => '{
  "carriers": [
    {
      "carrier": {
        "name": "string"
      }
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://tryenvoy.ai/api/v1/carriers/batch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"carriers\": [\n    {\n      \"carrier\": {\n        \"name\": \"string\"\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["carriers": [["carrier": ["name": "string"]]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://tryenvoy.ai/api/v1/carriers/batch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```