User
Note: The API key provided in the Authorization header must have the apik_ prefix.
Schema
A record representing a user, including personal and account-related information.
| Name | Type | Description |
|---|---|---|
| String(format:email) | The user’s email address | |
| first_name | String | The user’s first name |
| id | ULID | Unique identifier for the user |
| inserted_at | String(format:datetime) | When the user was created |
| last_name | String | The user’s last name |
| name | String | The display name of the user |
| updated_at | String(format:datetime) | When the user was last updated |
Examples
Create User
Creates a new user under the immediate parent account.
Request:
POST https://api.swift-api.com/api/v1/users HTTP/1.1Accept: application/json, text/plainContent-Type: application/jsonContent-Length: 64Authorization: Bearer apik_ABC123
{ "data": { "email": "john.doe@example.com", "first_name": "John", "last_name": "Doe", "name": "ACME User", "password": "string", "password_confirmation": "string", "role_id": "01JE9W7BX8CHRG7XP2SK0AVMKJ" }, "type": "user"}Response:
HTTP/1.1 201Content-Type: application/jsonContent-Length: 402
{ "data": { "email": "john.doe@example.com", "first_name": "John", "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "last_name": "Doe", "name": "ACME User", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "user"}Create User for Account
Creates a new user under a specified account.
Request:
POST https://api.swift-api.com/api/v1/accounts/{account_id}/users HTTP/1.1Accept: application/json, text/plainContent-Type: application/jsonContent-Length: 64Authorization: Bearer apik_ABC123
{ "data": { "email": "john.doe@example.com", "first_name": "John", "last_name": "Doe", "name": "ACME User", "password": "string", "password_confirmation": "string", "role_id": "01JE9W7BX8CHRG7XP2SK0AVMKJ" }, "type": "user"}Response:
HTTP/1.1 201Content-Type: application/jsonContent-Length: 402
{ "data": { "email": "john.doe@example.com", "first_name": "John", "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "last_name": "Doe", "name": "ACME User", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "user"}List Users
Lists all users that are associated with the parent account and all sub accounts.
Request:
GET https://api.swift-api.com/api/v1/users HTTP/1.1Accept: application/json, text/plainAuthorization: Bearer apik_ABC123Response:
HTTP/1.1 200Content-Type: application/jsonContent-Length: 673
{ "data": { "items": [ { "data": { "email": "john.doe@example.com", "first_name": "John", "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "last_name": "Doe", "name": "ACME User", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "user" } ], "page_info": { "after": "string", "before": "string", "limit": 0.0, "total": 0.0 } }, "type": "list"}Get User
Retrieve a specific user by ID.
Request:
GET https://api.swift-api.com/api/v1/users/{id} HTTP/1.1Accept: application/json, text/plainAuthorization: Bearer apik_ABC123Response:
HTTP/1.1 200Content-Type: application/jsonContent-Length: 402
{ "data": { "email": "john.doe@example.com", "first_name": "John", "id": "01J0CRVTXX9KBD9NWS02R5R8RT", "inserted_at": "2024-06-14T00:00:00.000000Z", "last_name": "Doe", "name": "ACME User", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "user"}