Skip to main content
POST
https://api.dcycle.io
/
v1
/
projects
/
{project_id}
/
entities
/
link
Link Entities to Project
const options = {
  method: 'POST',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({entity_type: '<string>', entity_ids: {}})
};

fetch('https://api.dcycle.io/v1/projects/{project_id}/entities/link', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "created": 123,
  "skipped": 123
}

Link Entities to Project

Link a batch of entities (by ID) to a project. Entities already linked are silently skipped — safe to call repeatedly with the same IDs.
New API: This endpoint is part of the new API architecture.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

project_id
string
required
The UUID of the project to link entities toExample: b7f2a1c3-4d5e-6f7a-8b9c-0d1e2f3a4b5c

Body Parameters

entity_type
string
required
The type of entities being linked.Available values: logistic_requests, logistic_recharges, logistic_packages, invoices, file_readings
entity_ids
array[string]
required
List of entity UUIDs to link. Minimum 1, maximum 100 per request.Example: ["550e8400-e29b-41d4-a716-446655440000", "660e8400-e29b-41d4-a716-446655440001"]

Response

created
integer
Number of new links created
skipped
integer
Number of entities that were already linked (skipped)

Example

curl -X POST "https://api.dcycle.io/v1/projects/b7f2a1c3-4d5e-6f7a-8b9c-0d1e2f3a4b5c/entities/link" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -H "Content-Type: application/json" \
  -d '{
    "entity_type": "logistic_requests",
    "entity_ids": [
      "550e8400-e29b-41d4-a716-446655440000",
      "660e8400-e29b-41d4-a716-446655440001"
    ]
  }'

Successful Response

{
  "created": 2,
  "skipped": 0
}

Common Errors

404 Not Found

Cause: Project not found or doesn’t belong to your organization
{
  "code": "NOT_FOUND",
  "detail": "Project not found"
}

422 Validation Error

Cause: Invalid entity_type or empty entity_ids
{
  "detail": [
    {
      "loc": ["body", "entity_type"],
      "msg": "value is not a valid enumeration member",
      "type": "type_error.enum"
    }
  ]
}