Skip to main content

APIs – Manage employees

Updated this week

Use these public APIs to create, update, and delete employees in your Swif organization:

  • POST /restful/organization/employees

  • PUT /restful/organization/employees/:employeeId

  • DELETE /restful/organization/employees/:employeeId

These endpoints are designed for customer integrations (HRIS, IAM, internal tools) and complement the existing public GET /restful/organization/employees endpoint (paging employees).

For general patterns and examples of using Swif APIs, see:
APIs – Device and evidence retrieval | Help Center | Swif.ai


1. Base URL and authentication

Base URL

Use the correct domain for your tenant:

  • Global tenant: https://api.swifteam.com

  • EU tenant: https://api.eu.swifteam.com

Example full URLs

  • POST https://api.swifteam.com/restful/organization/employees

  • PUT https://api.swifteam.com/restful/organization/employees/:employeeId

  • DELETE https://api.swifteam.com/restful/organization/employees/:employeeId

Replace api.swifteam.com with api.eu.swifteam.com if your org is on the EU tenant.

Authentication

All endpoints use your organization public API token.

Headers

Authorization: Bearer <YOUR_ORG_PUBLIC_API_TOKEN> Content-Type: application/json Accept: application/json

If the token is missing, invalid, expired, or for another organization, the APIs return:

  • 401 Unauthorized or

  • 403 Forbidden


2. Create employee

Endpoint

POST /restful/organization/employees

Creates a new employee in your organization (same entity visible in the Swif Admin Console).

Request body

The payload must follow the employee model defined in the public Postman collection for these APIs.

  • You must provide all required fields (such as email, firstName, lastName, status, and any other required fields for your tenant).

  • Optional fields (e.g., identifiers, title, department, manager reference, dates, labels) can also be provided.

  • Unknown fields are rejected with clear validation errors (they are not silently ignored).

Example – minimal payload

{
"email": "userA@example.com",
"firstName": "User",
"lastName": "Example",
"status": "ACTIVE"
}

Example – extended payload (illustrative)

{
"email": "userB@example.com",
"firstName": "Alex",
"lastName": "Doe",
"status": "ACTIVE",
"employeeId": "E-12345",
"title": "Senior Engineer",
"department": "Engineering",
"managerId": "69a065901f00006c00210832",
"startDate": "2024-01-15",
"endDate": null,
"labels": ["full-time", "remote-us"],
"identifiers": {
"hrisId": "HR-0001",
"idpId": "00u1234567890abcDEF7"
}
}

The exact field list, required fields, and enum values (e.g., valid status values) are defined in the latest Postman collection for these endpoints.

Response

  • Status: 201 Created (or 200 OK depending on spec)

  • Body: The created employee object, including the generated internal id:

{
"id": "69a065901f00006c00210832",
"email": "userB@example.com",
"firstName": "Alex",
"lastName": "Doe",
"status": "ACTIVE"
// ... other fields
}

Use this internal id in subsequent PUT and DELETE calls.

Validation and error handling

Typical behaviors:

  • Missing required field

    • Status: 400 Bad Request

    • Body: Error describing which field is missing or invalid.

    • No employee is created.

  • Duplicate unique value (e.g., email or unique employeeId)

    • Status: 400 or 409 Conflict

    • Body: Error indicating duplicate constraint (for example, “email already exists”).

    • No duplicate employee is created; the existing employee remains unchanged.


3. Update employee

Endpoint

PUT /restful/organization/employees/:employeeId

Updates an existing employee using the internal Swif employee id.

  • :employeeId is the internal id returned from POST /restful/organization/employees or retrieved via GET /restful/organization/employees.

  • It is not necessarily your HRIS or HR “employee number” (unless you map that into a custom field).

Request

PUT https://api.swifteam.com/restful/organization/employees/69a065901f00006c00210832
Authorization: Bearer <TOKEN>
Content-Type: application/json

The request body must follow the payload shape defined in the Postman collection for updateEmployeeForPartner. That contract also defines whether PUT is treated as:

  • Full replace – omitted optional fields may be cleared/reset, or

  • Partial update – omitted fields are left unchanged.

Example – update job details

{
"title": "Staff Engineer",
"department": "Platform Engineering",
"status": "ACTIVE",
"labels": ["full-time", "remote-us", "platform"]
}

Response

  • Status: 200 OK

  • Body: The full employee object as stored after the update.

Error behavior

  • Employee not found

    • Status: 404 Not Found

    • Body: Error such as "Employee not found".

    • No data is created or changed.

  • Validation errors

    • Status: 400 Bad Request

    • Body: Error describing invalid fields (e.g., invalid enum, malformed date, unknown field name).

Behavior for partial vs full update follows the updated contract used in testing (see Postman payload used in QA scenarios).


4. Delete employee

Endpoint

DELETE /restful/organization/employees/:employeeId

Deletes (or soft‑deletes, depending on implementation) an employee by internal id.

Request

DELETE https://api.swifteam.com/restful/organization/employees/69a065901f00006c00210832 Authorization: Bearer <TOKEN>

Response

  • Status: 204 No Content (or another success status defined in the spec)

  • Body: Empty.

After a successful delete:

  • The employee no longer appears in GET /restful/organization/employees results for your organization.

  • Internal tools (e.g., Employee Manager) show the employee as removed/soft‑deleted, depending on implementation.

Error behavior

  • Employee not found

    • Status: 404 Not Found (or equivalent)

    • Body: Error such as "Employee not found".

    • No side effects and no 500 error.


5. Read employees and IDs for use with PUT/DELETE

Use the public GET /restful/organization/employees endpoint to:

  • Confirm that a newly created employee appears in the list.

  • Retrieve the internal id to pass into:

    • PUT /restful/organization/employees/:employeeId

    • DELETE /restful/organization/employees/:employeeId

  • Verify that updates or deletes have taken effect.

Did this answer your question?