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

# List Workforce Contracts

> Retrieve the contracts of one own workforce employee

[← Own Workforce API](/api-reference/own-workforce/overview)

Return every contract belonging to one employee, oldest to newest. The employee is required: contracts carry no organization of their own, so there is no free-standing contract list.

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

### Query Parameters

<ParamField query="own_workforce_id" type="string" required>
  Employee UUID, from [List Workforce Employees](/api-reference/own-workforce/list)

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

## Response

A bare JSON array of contracts, with only the fields needed to place them in time. For the full detail of one contract — hours ratio, category, contract type, end reason — call [Get Workforce Contract](/api-reference/own-workforce/get-contract).

<ResponseField name="id" type="string">
  Contract UUID. Pass it to [List Workforce Remunerations](/api-reference/own-workforce/list-remunerations) to get the salaries attached to it.
</ResponseField>

<ResponseField name="start_date" type="string">
  `YYYY-MM-DD`
</ResponseField>

<ResponseField name="end_date" type="string | null">
  `YYYY-MM-DD`. Null means the contract is open-ended.
</ResponseField>

<Note>
  An employee can have several contracts, including consecutive ones after a renewal or a change of terms. Do not assume a single current contract.
</Note>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X GET "https://api.dcycle.io/v1/own_workforce_contracts?own_workforce_id=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 os

  import requests

  headers = {
      "x-api-key": os.getenv("DCYCLE_API_KEY"),
      "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
  }

  response = requests.get(
      "https://api.dcycle.io/v1/own_workforce_contracts",
      headers=headers,
      params={"own_workforce_id": "550e8400-e29b-41d4-a716-446655440000"},
  )

  for contract in response.json():
      print(contract["start_date"], "→", contract["end_date"] or "open-ended")
  ```

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

  const headers = {
    'x-api-key': process.env.DCYCLE_API_KEY,
    'x-organization-id': process.env.DCYCLE_ORG_ID
  };

  axios.get('https://api.dcycle.io/v1/own_workforce_contracts', {
    headers,
    params: { own_workforce_id: '550e8400-e29b-41d4-a716-446655440000' }
  })
  .then(response => {
    response.data.forEach(contract => {
      console.log(contract.start_date, '→', contract.end_date || 'open-ended');
    });
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
[
  {
    "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "start_date": "2023-06-01",
    "end_date": null
  }
]
```

## Common Errors

### 401 Unauthorized

**Cause:** the key is invalid, or it does not belong to the organization in `x-organization-id` — the two are looked up as a pair. A request carrying no credentials at all answers `AUTH_REQUIRED` instead.

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

### 403 Forbidden

**Cause:** the key's owner is not an enabled member of the organization in `x-organization-id`.

```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:** no employee with that `own_workforce_id` inside your perimeter. An employee belonging to another organization answers 404, identical to one that does not exist, so the endpoint cannot be used to probe for ids.

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

### 422 Unprocessable Entity

**Cause:** `own_workforce_id` missing or not a UUID. It is required — omitting it does not return all contracts.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "type": "missing",
      "loc": ["query", "own_workforce_id"],
      "msg": "Field required"
    }
  ]
}
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get contract" icon="file-signature" href="/api-reference/own-workforce/get-contract">
    Full detail of one contract
  </Card>

  <Card title="List remunerations" icon="money-bill" href="/api-reference/own-workforce/list-remunerations">
    Salaries attached to a contract
  </Card>
</CardGroup>
