Skip to main content
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"
        }
      ]
    }
  ]
}
'
{
  "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"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://developers.projectcor.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

contract_id
integer
required

Body

application/json
users
object[]
required

Response

200 - application/json

Users attached to contract with full or partial success

status
enum<string>

Result status for attach operation

Available options:
success,
partial_success,
failure
company_id
integer

Company ID

contract_id
integer

Contract ID

records_received
integer

Total number of date records received

records_created
integer

Total number of date records successfully created

records_rejected
integer

Total number of date records rejected

user_ids
integer[]

Array of user IDs that were successfully assigned to the contract

assigned
object[]

Array of user assignments for the contract

errors
object[]

Array of user assignments that failed to be assigned to the contract