### 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-delete-onboarded-carrier-contact` permission is required to access this endpoint.

### Endpoint

- **URL:** `https://api.genlogs.io/onboarded-carrier/contacts/{contact_id}`
- **Method:** `DELETE`

### 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.

### Path Params

- **contact_id** (string, UUID format, required): Existent contact ID, to be deleted.

### Request Example:

```bash
curl --location --request DELETE 'https://api.genlogs.io/onboarded-carrier/contacts/<contact_id>' \
--header 'access-token: <your-api-access-token>' \
--header 'x-api-key: <your-x-api-key>' \
--header 'Content-Type: application/json' \
```

### Response:

- **200 OK:** A JSON object containing the information of the deleted carrier contact.
- **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.
- **404 Not Found**: If the provided `contact_id` doesn't exist or is not created.
- **500 Internal Server Error:** If there is an issue on the server that prevents processing the request.

### Response Body:

#### 200 OK – Contact Deleted Successfully

```json
{
    "contact": {
        "contact_name": "some_name",
        "phone_number": "1-222-333-444",
        "email_address": "some_user@testemail.com",
        "usdot_number": "1324354657",
        "contact_id": <contact_id>,
        "customer_id": <customer_id>
    },
    "deleted": true
}
```

#### 400 Bad Request

Returned when:

- The provided contact id is malformed or missing

```json
{
    "detail": "Error deleting onboarded carrier contact: {message}"
}
```

#### 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

```json
{
    "detail": "Preferred carrier contact not found."
}
```

### Delete an onboarded carrier contact

**Endpoint:** `DELETE https://api.genlogs.io/onboarded-carrier/contacts/{contact_id}`

Deletes an existing onboarded carrier contact for the authenticated customer. Requires a valid JWT token and the appropriate permission. The contact must belong to the authenticated customer.

**Authorizations**: AccessTokenAuth & ApiKeyAuth

**Path parameters**
- **contact_id** (string, uuid, required): Unique identifier of the contact to delete. Example: `bd849e72-09f0-4d19-8b20-e227cd4ef455`

**Responses**
- **200**: Contact deleted successfully.

```json
{
    "contact": {
        "id": "bd849e72-09f0-4d19-8b20-e227cd4ef455",
        "deleted": true
    }
}
```

- **400**: Bad Request – Invalid contact identifier.
- **401**: Unauthorized – Invalid or missing Access-Token.
- **403**: Forbidden – The user lacks required permission or does not own the contact.
- **404**: Contact not found.
- **500**: Internal Server Error.
