# Create Onboarded Carriers Bulk

### **Authentication**

* Include your **`Access-Token`** in the header of your requests.
* Include your **`x-api-key`** The API key provided by GenLogs. This header must be included in the request.

### Permissions

The `external-api-create-onboarded-carrier-contact` permission is required to access this endpoint.

### **Endpoint**

* **URL:**  `https://api.genlogs.io/onboarded-carrier/bulk/contacts`
* **Method:** `POST`

### **Headers**

* **Access-Token**:  (string, required): Access token obtained from the "Create Access Token" endpoint.
* **X-Api-Key** (string, required): The API key provided by GenLogs.

### Request body

* **contacts** (list, object,  required): List of contacts to be created. Including:
  * **usdot** (string, required): Carrier USDOT number. Must be a non-empty value.
  * **name** (string, optional): Contact name.&#x20;
  * **phone** (string, optional): Contact phone number
  * **email** (string, optional): Contact email address.

### Request Example:

```shell
curl --location --request POST 'https://api.genlogs.io/onboarded-carrier/bulk/contacts' \
--header 'access-token: <your-api-access-token>' \
--header 'x-api-key: <your-x-api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "contacts": [
        {
            "usdot": "1324354657",
            "name": "Peter Parker",
            "phone": "3432434234",
            "email": "peter.parker@marvel.com"
        },
        {
            "usdot": "1324354657",
            "name": "Mary Jane",
            "phone": "5423123456",
            "email": "mary.jane@marvel.com"
        }
    ]
}'
```

### **Response:**

* **200 OK:** A JSON object containing two lists for:
  * **Success**: created carrier contact(s) with relevant information including `usdot`, `name` and `id`.
  * **Failed**: failed creation with `index` and `reason`.
* **400 Bad Request:** If required parameters are missing or invalid.
* **401 Unauthorized:** If the authentication credentials (Access-Token) is missing or incorrect.
* **403 Forbidden**: If the permission has not been added to your user.
* **500 Internal Server Error:** If there is an issue on the server that prevents processing the request.

### **Response Body:**

200 OK – Contacts Deleted Successfully

```json
{
    "contacts": [
        {
            "usdot": "1324354657",
            "name": "Peter Parker",
            "phone": "3432434234",
            "email": "peter.parker@marvel.com"
        },
        {
            "usdot": "1324354657",
            "name": "Mary Jane",
            "phone": "5423123456",
            "email": "mary.jane@marvel.com"
        }
    ]
}
```

400 Bad Request

Returned when:

* The provided contacts list is malformed or missing
* Malformed `usdot`  number
*

```json
{
    "detail": "Missing required field: contacts"
}
```

```json
{
    "detail": "All contacts failed to be created"
}
```

```json
{
    "detail": "Value error, usdot_number must contain only digits."
}
```

```json
{
    "detail": "contacts list must not be empty"
}
```

401 Unauthorized

* When access-token is missing or expired

```json
{
    "detail": "Token is missing!"
}
```

```json
{
    "detail": "Token is expired!"
}
```

403 Forbidden

```json
{
    "detail": "User not allowed to access this endpoint"
}
```

404 Not Found

## Bulk create onboarded carrier contacts

> Creates multiple onboarded carrier contacts for the authenticated customer in a single request. Each contact entry is validated using the same rules as the single-contact create flow. At least one contact must be valid for the operation to succeed. The operation follows the same authorization, repository, caching, and creation logic as the single-contact create flow.<br>

```json
{"openapi":"3.0.3","info":{"title":"Onboarded Carrier Contacts API","version":"1.1.0"},"servers":[{"url":"https://api.genlogs.io"}],"security":[{"AccessTokenAuth":[],"ApiKeyAuth":[]}],"paths":{"/onboarded-carrier/bulk/contacts":{"post":{"summary":"Bulk create onboarded carrier contacts","description":"Creates multiple onboarded carrier contacts for the authenticated customer in a single request. Each contact entry is validated using the same rules as the single-contact create flow. At least one contact must be valid for the operation to succeed. The operation follows the same authorization, repository, caching, and creation logic as the single-contact create flow.\n","tags":["Onboarded Carriers"],"requestBody":{"required":true,"description":"List of onboarded carrier contact definitions to create. The contacts array must be non-empty.\n","content":{"application/json":{"schema":{"type":"object","required":["contacts"],"properties":{"contacts":{"type":"array","minItems":1,"description":"List of contacts to create.","items":{"type":"object","required":["usdot"],"properties":{"usdot":{"type":"string","description":"Carrier USDOT number. Must be a non-empty value."},"name":{"type":"string","nullable":true,"description":"Contact name."},"phone":{"type":"string","nullable":true,"description":"Contact phone number."},"email":{"type":"string","nullable":true,"description":"Contact email address."}}}}}}}}},"responses":{"200":{"description":"Contacts processed successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"created_contacts":{"type":"array","description":"List of successfully created contacts.","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"usdot":{"type":"string"},"name":{"type":"string"}}}},"failed_contacts":{"type":"array","description":"Per-item errors for contacts that were not created.","items":{"type":"object","properties":{"index":{"type":"integer","description":"Index of the contact in the original payload."},"error":{"type":"string","description":"Human-readable error message for this item."}}}}}}}}},"400":{"description":"Bad Request – Invalid request body or all items failed.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"401":{"description":"Unauthorized – Invalid or missing Access-Token.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"403":{"description":"Forbidden – Missing required permission.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.genlogs.io/carrier/onboarded-carriers/create-onboarded-carriers-bulk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
