List Workforce Contracts
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/own_workforce_contracts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/own_workforce_contracts"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/own_workforce_contracts \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"start_date": "<string>",
"end_date": {}
}List Workforce Contracts
Retrieve the contracts of one own workforce employee
GET
/
v1
/
own_workforce_contracts
List Workforce Contracts
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/own_workforce_contracts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/own_workforce_contracts"
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>"
}
response = requests.get(url, headers=headers)
print(response.text)curl --request GET \
--url https://api.dcycle.io/v1/own_workforce_contracts \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"start_date": "<string>",
"end_date": {}
}← Own Workforce API
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
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faQuery Parameters
string
required
Employee UUID, from List Workforce EmployeesExample:
own_workforce_id=550e8400-e29b-41d4-a716-446655440000Response
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.string
Contract UUID. Pass it to List Workforce Remunerations to get the salaries attached to it.
string
YYYY-MM-DDstring | null
YYYY-MM-DD. Null means the contract is open-ended.An employee can have several contracts, including consecutive ones after a renewal or a change of terms. Do not assume a single current contract.
Example
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}"
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")
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));
Successful Response
[
{
"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 inx-organization-id — the two are looked up as a pair. A request carrying no credentials at all answers AUTH_REQUIRED instead.
{
"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 inx-organization-id.
{
"detail": "Logged User is not Member of Organization",
"code": "LOGGED_USER_NOT_MEMBER"
}
404 Not Found
Cause: no employee with thatown_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.
{
"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.
{
"detail": [
{
"type": "missing",
"loc": ["query", "own_workforce_id"],
"msg": "Field required"
}
]
}
Related Endpoints
Get contract
Full detail of one contract
List remunerations
Salaries attached to a contract
Was this page helpful?