Skip to main content
DELETE
https://api.dcycle.io
/
v1
/
employee-historic
/
{employee_historic_id}
Delete Commuting Period
const options = {
  method: 'DELETE',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/employee-historic/{employee_historic_id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Delete Commuting Period

Permanently delete a commuting period. This will remove the period’s CO2e contribution from the employee’s total emissions.
Irreversible Action: Deleting a period permanently removes the commuting data and its CO2e calculations.

Request

Headers

x-api-key
string
required
Your API key for authentication
x-organization-id
string
required
Your organization UUID

Path Parameters

employee_historic_id
string
required
The unique identifier (UUID) of the commuting period to deleteExample: 660e8400-e29b-41d4-a716-446655440000

Response

Returns 204 No Content on successful deletion.

Example

curl -X DELETE "https://api.dcycle.io/v1/employee-historic/660e8400-e29b-41d4-a716-446655440000" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}"

Successful Response

HTTP/1.1 204 No Content

Common Errors

404 Not Found

Cause: Period not found
{
  "code": "EMPLOYEE_HISTORIC_NOT_FOUND",
  "detail": "EmployeeHistoric with id=UUID('...') not found"
}

Use Cases

Delete Incorrect Period

def delete_period(period_id):
    """Delete a commuting period"""
    response = requests.delete(
        f"https://api.dcycle.io/v1/employee-historic/{period_id}",
        headers=headers
    )
    return response.status_code == 204

success = delete_period("660e8400-e29b-41d4-a716-446655440000")

Replace Period (Delete + Create)

def replace_period(old_period_id, new_period_data):
    """Replace a period with new data"""
    # Delete old
    requests.delete(
        f"https://api.dcycle.io/v1/employee-historic/{old_period_id}",
        headers=headers
    )

    # Create new
    response = requests.post(
        "https://api.dcycle.io/v1/employee-historic",
        headers=headers,
        json=new_period_data
    )
    return response.json()