Get Workforce Contract
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/{contract_id}', 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/{contract_id}"
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/{contract_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"start_date": "<string>",
"end_date": {},
"working_hours_ratio": 123,
"labor_agreement": true,
"employment_category": "<string>",
"own_workforce_contract_type": "<string>",
"own_workforce_contract_end_contract_reason": {},
"location_code": "<string>",
"contract_annual_working_hours": {}
}Get Workforce Contract
Retrieve one workforce contract with its terms, category and contract type
GET
/
v1
/
own_workforce_contracts
/
{contract_id}
Get Workforce Contract
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/{contract_id}', 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/{contract_id}"
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/{contract_id} \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>'{
"id": "<string>",
"start_date": "<string>",
"end_date": {},
"working_hours_ratio": 123,
"labor_agreement": true,
"employment_category": "<string>",
"own_workforce_contract_type": "<string>",
"own_workforce_contract_end_contract_reason": {},
"location_code": "<string>",
"contract_annual_working_hours": {}
}← Own Workforce API
Return one contract in full: dates, working-hours ratio, employment category, contract type and, when it has ended, the reason.
Request
Headers
string
required
Your API key for authenticationExample:
sk_live_1234567890abcdefstring
required
Your organization UUIDExample:
a8315ef3-dd50-43f8-b7ce-d839e68d51faPath Parameters
string
required
Contract UUID, from List Workforce ContractsExample:
7c9e6679-7425-40de-944b-e07fc1f90ae7Response
string
Contract UUID
string
YYYY-MM-DDstring | null
Null means open-ended
number
Share of a full-time schedule, between 0 (exclusive) and 1.
1 is full time, 0.5 is half time. This is the value that drives FTE.boolean
Whether the contract is covered by a collective labour agreement
string
Free-text job category as uploaded
string
Contract type name, resolved from the catalogue — e.g.
permanentstring | null
Why the contract ended, resolved from the catalogue. Null while it is open.
string
Country name of the work location.Note the inconsistency with List Workforce Employees, where a field of the same name carries the location name rather than its country. Do not join the two on this field.
number | null
Annual hours set by the labour agreement. Null when it was not provided.
Example
curl -X GET "https://api.dcycle.io/v1/own_workforce_contracts/7c9e6679-7425-40de-944b-e07fc1f90ae7" \
-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"),
}
contract_id = "7c9e6679-7425-40de-944b-e07fc1f90ae7"
response = requests.get(
f"https://api.dcycle.io/v1/own_workforce_contracts/{contract_id}",
headers=headers,
)
contract = response.json()
print(f"{contract['own_workforce_contract_type']} at {contract['working_hours_ratio']} FTE")
const axios = require('axios');
const headers = {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID
};
const contractId = '7c9e6679-7425-40de-944b-e07fc1f90ae7';
axios.get(`https://api.dcycle.io/v1/own_workforce_contracts/${contractId}`, { headers })
.then(({ data }) => {
console.log(`${data.own_workforce_contract_type} at ${data.working_hours_ratio} FTE`);
})
.catch(error => console.error(error));
Successful Response
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"start_date": "2023-06-01",
"end_date": null,
"working_hours_ratio": 1.0,
"labor_agreement": true,
"employment_category": "Engineer",
"own_workforce_contract_type": "permanent",
"own_workforce_contract_end_contract_reason": null,
"location_code": "Spain",
"contract_annual_working_hours": 1800.0
}
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 contract with that id inside your perimeter. A contract whose employee belongs to another organization answers 404, not 403.{
"code": "NOT_FOUND",
"detail": "OwnWorkforceContractModel with id='550e8400-e29b-41d4-a716-446655440000' not found"
}
Related Endpoints
List contracts
All contracts of an employee
List remunerations
Salaries attached to this contract
Was this page helpful?