Skip to main content
POST
/
v1
/
employees
/
csv
CSV Import
const options = {
  method: 'POST',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'Content-Type': '<content-type>'
  },
  body: JSON.stringify({
    lang: '<string>',
    start_date: '<string>',
    end_date: '<string>',
    subject: '<string>',
    deadline: '<string>'
  })
};

fetch('https://api.dcycle.io/v1/employees/csv', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "<string>",
  "name": {},
  "email": {},
  "organization_id": "<string>",
  "situation": {},
  "status": "<string>",
  "periods": {},
  "created_at": {},
  "updated_at": {}
}

CSV Import

Create multiple employees from a CSV file and automatically send commuting survey emails to each one. The CSV must contain at least an email column.

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
Content-Type
string
required
Must be multipart/form-data

Form Parameters

file
file
required
CSV file with at least an email column header
lang
string
required
Survey language code. Values: ar, ca, de, en, es, fr, it, pt, zh
start_date
string
required
Survey period start date (YYYY-MM-DD)
end_date
string
required
Survey period end date (YYYY-MM-DD)
subject
string
required
Email subject line (1–255 characters)
deadline
string
Survey response deadline (YYYY-MM-DD). After this date, the survey link expires.

Response

Returns an array of created employees (HTTP 201).
id
string
Unique identifier (UUID) for the employee
name
string | null
Employee’s full name
email
string | null
Employee’s email address
organization_id
string
Organization UUID
situation
string | null
Employment status: active, inactive, or terminated
status
string
Data status: uploaded or loading
periods
array | null
List of commuting periods (empty for newly imported employees)
created_at
datetime
Timestamp when the employee was created
updated_at
datetime | null
Timestamp when the employee was last updated

Example

curl -X POST "https://api.dcycle.io/v1/employees/csv" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -F "file=@employees.csv" \
  -F "lang=en" \
  -F "start_date=2025-01-01" \
  -F "end_date=2025-12-31" \
  -F "subject=Commuting Survey 2025" \
  -F "deadline=2025-02-28"

Successful Response

[
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": null,
    "email": "jane.doe@example.com",
    "organization_id": "org-uuid",
    "situation": "active",
    "status": "loading",
    "created_at": "2025-01-15T10:00:00Z",
    "updated_at": "2025-01-15T10:00:00Z",
    "periods": []
  }
]

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}

403 Forbidden

Cause: The authenticated user is not a member of the organization
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}

422 Unprocessable Entity

Cause: Invalid CSV format or missing required columns
{
  "detail": [
    {
      "loc": ["body", "file"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

Create Employee

Create a single employee

Resend Survey

Resend survey to existing employees