> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Business Travel

> Delete a business travel record from your organization

# Delete Business Travel

Permanently delete a business travel record from your organization. This action cannot be undone.

<Warning>
  **Permanent Action**: Deleting a business travel record is permanent and cannot be undone. The associated emissions data will also be removed from your organization's totals.
</Warning>

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Path Parameters

<ParamField path="business_travel_id" type="string" required>
  The unique identifier (UUID) of the business travel record to delete

  **Example:** `550e8400-e29b-41d4-a716-446655440000`
</ParamField>

## Response

Returns `204 No Content` on successful deletion. No response body.

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X DELETE "https://api.dcycle.io/v1/business-travels/550e8400-e29b-41d4-a716-446655440000" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  travel_id = "550e8400-e29b-41d4-a716-446655440000"

  response = requests.delete(
      f"https://api.dcycle.io/v1/business-travels/{travel_id}",
      headers={
          "x-api-key": os.getenv("DCYCLE_API_KEY"),
          "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
      },
  )

  if response.status_code == 204:
      print("Business travel deleted successfully")
  else:
      print(f"Error: {response.json()}")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const travelId = '550e8400-e29b-41d4-a716-446655440000';

  axios.delete(
    `https://api.dcycle.io/v1/business-travels/${travelId}`,
    {
      headers: {
        'x-api-key': process.env.DCYCLE_API_KEY,
        'x-organization-id': process.env.DCYCLE_ORG_ID,
      },
    }
  )
  .then(response => {
    if (response.status === 204) {
      console.log('Business travel deleted successfully');
    }
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

```
HTTP/1.1 204 No Content
```

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
```

### 403 Forbidden

**Cause:** The authenticated user is not a member of the organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
```

### 404 Not Found

**Cause:** Business travel not found or doesn't belong to your organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"detail": "BusinessTravel with id=550e8400-e29b-41d4-a716-446655440000 not found", "code": "BUSINESS_TRAVEL_NOT_FOUND"}
```

## Use Cases

### Delete with Confirmation

Fetch the record first to confirm before deleting:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
def delete_business_travel(travel_id, confirm=False):
    travel = requests.get(
        f"https://api.dcycle.io/v1/business-travels/{travel_id}",
        headers=headers,
    ).json()

    if not confirm:
        print(f"About to delete:")
        print(f"  Date: {travel['start_date']} to {travel['end_date']}")
        print(f"  Route: {travel.get('origin', 'N/A')} -> {travel.get('destination', 'N/A')}")
        print(f"  Emissions: {travel['co2e']} kg CO2e")
        return False

    response = requests.delete(
        f"https://api.dcycle.io/v1/business-travels/{travel_id}",
        headers=headers,
    )
    return response.status_code == 204
```

<Note>
  For deleting multiple records at once, use the [Bulk Delete](/api-reference/business-travels/bulk-delete) or [Bulk Delete by Filters](/api-reference/business-travels/bulk-delete-by-filters) endpoints instead of looping over individual deletes.
</Note>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get Business Travel" icon="magnifying-glass" href="/api-reference/business-travels/get">
    Get business travel details before deleting
  </Card>

  <Card title="List Business Travels" icon="list" href="/api-reference/business-travels/list">
    Retrieve all business travels
  </Card>

  <Card title="Bulk Delete" icon="trash" href="/api-reference/business-travels/bulk-delete">
    Delete multiple records by ID
  </Card>

  <Card title="Create Business Travel" icon="plus" href="/api-reference/business-travels/create">
    Create a new business travel record
  </Card>
</CardGroup>
