# Delete Onboarded Carrier

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

```shell
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

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

```json
{"openapi":"3.0.3","info":{"title":"Onboarded Carrier Contacts API","version":"1.0.0"},"servers":[{"url":"https://api.genlogs.io"}],"security":[{"AccessTokenAuth":[],"ApiKeyAuth":[]}],"paths":{"/onboarded-carrier/contacts/{contact_id}":{"delete":{"summary":"Delete an onboarded carrier contact","description":"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.\n","tags":["Onboarded Carriers"],"parameters":[{"name":"contact_id","in":"path","required":true,"description":"Unique identifier of the contact to delete.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Contact deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deleted":{"type":"boolean"}}}}}}}},"400":{"description":"Bad Request – Invalid contact identifier.","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 – The user lacks required permission or does not own the contact.\n","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"404":{"description":"Contact not found.","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"}}}}}}}}}}}
```
