Attach users to a contract
curl --request POST \
--url https://api.projectcor.com/v1/contracts/{contract_id}/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"users": [
{
"id": 123,
"dates": [
{
"start": "2026-01-01",
"end": "2026-02-01"
},
{
"start": "2026-01-01",
"end": "2026-02-02"
}
]
}
]
}
'import requests
url = "https://api.projectcor.com/v1/contracts/{contract_id}/users"
payload = { "users": [
{
"id": 123,
"dates": [
{
"start": "2026-01-01",
"end": "2026-02-01"
},
{
"start": "2026-01-01",
"end": "2026-02-02"
}
]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
users: [
{
id: 123,
dates: [
{start: '2026-01-01', end: '2026-02-01'},
{start: '2026-01-01', end: '2026-02-02'}
]
}
]
})
};
fetch('https://api.projectcor.com/v1/contracts/{contract_id}/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.projectcor.com/v1/contracts/{contract_id}/users';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
users: [
{
id: 123,
dates: [
{start: '2026-01-01', end: '2026-02-01'},
{start: '2026-01-01', end: '2026-02-02'}
]
}
]
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.projectcor.com/v1/contracts/{contract_id}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'users' => [
[
'id' => 123,
'dates' => [
[
'start' => '2026-01-01',
'end' => '2026-02-01'
],
[
'start' => '2026-01-01',
'end' => '2026-02-02'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.projectcor.com/v1/contracts/{contract_id}/users"
payload := strings.NewReader("{\n \"users\": [\n {\n \"id\": 123,\n \"dates\": [\n {\n \"start\": \"2026-01-01\",\n \"end\": \"2026-02-01\"\n },\n {\n \"start\": \"2026-01-01\",\n \"end\": \"2026-02-02\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "partial_success",
"company_id": 999,
"contract_id": 777,
"records_received": 8,
"records_created": 2,
"records_rejected": 8,
"assigned": [
{
"id": 501,
"user_id": 88001,
"start_date": "2024-01-01T00:00:00.000Z",
"end_date": "2024-12-31T00:00:00.000Z"
},
{
"id": 502,
"user_id": 88001,
"start_date": "2024-03-01T00:00:00.000Z",
"end_date": "2024-06-30T00:00:00.000Z"
}
],
"errors": [
{
"id": 88001,
"dates": [
{
"start": "2024-06-01",
"end": "2024-04-01",
"message": "Date malformatted. Start date must be before end date"
},
{
"start": null,
"end": null,
"message": "Date malformatted"
},
{
"start": "2024-02-01",
"end": null,
"message": "Date malformatted. Start and end date are required"
},
{
"start": "not-a-date",
"end": "2024-12-31",
"message": "Invalid date"
},
{
"start": "1990-01-01",
"end": "1990-06-30",
"message": "Invalid contract periods. Range must be within contract start and end dates"
}
],
"message": "Partial success. Some dates were rejected"
},
{
"id": "hello",
"dates": [
{
"start": "2024-01-01",
"end": "2024-12-31"
}
],
"message": "User malformatted"
},
{
"id": 88002,
"start": "2024-01-01",
"end": "2024-12-31",
"message": "Legacy format detected. Use \"dates\" array instead of \"start\" and \"end\" fields"
},
{
"id": 88003,
"dates": [],
"message": "Date malformatted or empty"
},
{
"id": 88004,
"dates": [
{
"start": "2024-07-01",
"end": "2024-07-01",
"message": "Date malformatted. Start date must be before end date"
}
],
"message": "Dates are malformatted or empty"
},
{
"id": 88005,
"dates": [
{
"start": null,
"end": null,
"message": "Date malformatted"
}
],
"message": "Partial success. Some dates were rejected"
},
{
"id": 999999,
"dates": [
{
"start": "2024-01-01",
"end": "2024-12-31"
}
],
"message": "User malformatted"
},
{
"id": 88005,
"dates": [
{
"start": "2024-01-01",
"end": "2024-06-30"
}
],
"message": "User malformatted"
}
]
}Contract Users
Attach users to a contract
Attaches one or more users to a contract, each with one or more date ranges.
POST
/
contracts
/
{contract_id}
/
users
Attach users to a contract
curl --request POST \
--url https://api.projectcor.com/v1/contracts/{contract_id}/users \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"users": [
{
"id": 123,
"dates": [
{
"start": "2026-01-01",
"end": "2026-02-01"
},
{
"start": "2026-01-01",
"end": "2026-02-02"
}
]
}
]
}
'import requests
url = "https://api.projectcor.com/v1/contracts/{contract_id}/users"
payload = { "users": [
{
"id": 123,
"dates": [
{
"start": "2026-01-01",
"end": "2026-02-01"
},
{
"start": "2026-01-01",
"end": "2026-02-02"
}
]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
users: [
{
id: 123,
dates: [
{start: '2026-01-01', end: '2026-02-01'},
{start: '2026-01-01', end: '2026-02-02'}
]
}
]
})
};
fetch('https://api.projectcor.com/v1/contracts/{contract_id}/users', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.projectcor.com/v1/contracts/{contract_id}/users';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
users: [
{
id: 123,
dates: [
{start: '2026-01-01', end: '2026-02-01'},
{start: '2026-01-01', end: '2026-02-02'}
]
}
]
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.projectcor.com/v1/contracts/{contract_id}/users",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'users' => [
[
'id' => 123,
'dates' => [
[
'start' => '2026-01-01',
'end' => '2026-02-01'
],
[
'start' => '2026-01-01',
'end' => '2026-02-02'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.projectcor.com/v1/contracts/{contract_id}/users"
payload := strings.NewReader("{\n \"users\": [\n {\n \"id\": 123,\n \"dates\": [\n {\n \"start\": \"2026-01-01\",\n \"end\": \"2026-02-01\"\n },\n {\n \"start\": \"2026-01-01\",\n \"end\": \"2026-02-02\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "partial_success",
"company_id": 999,
"contract_id": 777,
"records_received": 8,
"records_created": 2,
"records_rejected": 8,
"assigned": [
{
"id": 501,
"user_id": 88001,
"start_date": "2024-01-01T00:00:00.000Z",
"end_date": "2024-12-31T00:00:00.000Z"
},
{
"id": 502,
"user_id": 88001,
"start_date": "2024-03-01T00:00:00.000Z",
"end_date": "2024-06-30T00:00:00.000Z"
}
],
"errors": [
{
"id": 88001,
"dates": [
{
"start": "2024-06-01",
"end": "2024-04-01",
"message": "Date malformatted. Start date must be before end date"
},
{
"start": null,
"end": null,
"message": "Date malformatted"
},
{
"start": "2024-02-01",
"end": null,
"message": "Date malformatted. Start and end date are required"
},
{
"start": "not-a-date",
"end": "2024-12-31",
"message": "Invalid date"
},
{
"start": "1990-01-01",
"end": "1990-06-30",
"message": "Invalid contract periods. Range must be within contract start and end dates"
}
],
"message": "Partial success. Some dates were rejected"
},
{
"id": "hello",
"dates": [
{
"start": "2024-01-01",
"end": "2024-12-31"
}
],
"message": "User malformatted"
},
{
"id": 88002,
"start": "2024-01-01",
"end": "2024-12-31",
"message": "Legacy format detected. Use \"dates\" array instead of \"start\" and \"end\" fields"
},
{
"id": 88003,
"dates": [],
"message": "Date malformatted or empty"
},
{
"id": 88004,
"dates": [
{
"start": "2024-07-01",
"end": "2024-07-01",
"message": "Date malformatted. Start date must be before end date"
}
],
"message": "Dates are malformatted or empty"
},
{
"id": 88005,
"dates": [
{
"start": null,
"end": null,
"message": "Date malformatted"
}
],
"message": "Partial success. Some dates were rejected"
},
{
"id": 999999,
"dates": [
{
"start": "2024-01-01",
"end": "2024-12-31"
}
],
"message": "User malformatted"
},
{
"id": 88005,
"dates": [
{
"start": "2024-01-01",
"end": "2024-06-30"
}
],
"message": "User malformatted"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
Show child attributes
Show child attributes
Response
200 - application/json
Users attached to contract with full or partial success
Result status for attach operation
Available options:
success, partial_success, failure Company ID
Contract ID
Total number of date records received
Total number of date records successfully created
Total number of date records rejected
Array of user IDs that were successfully assigned to the contract
Array of user assignments for the contract
Show child attributes
Show child attributes
Array of user assignments that failed to be assigned to the contract
Show child attributes
Show child attributes
Was this page helpful?
⌘I

