Skip to content

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.

NameTypeDescription
emailString(format:email)The user’s email address
first_nameStringThe user’s first name
idULIDUnique identifier for the user
inserted_atString(format:datetime)When the user was created
last_nameStringThe user’s last name
nameStringThe display name of the user
updated_atString(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.1
Accept: application/json, text/plain
Content-Type: application/json
Content-Length: 64
Authorization: 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 201
Content-Type: application/json
Content-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.1
Accept: application/json, text/plain
Content-Type: application/json
Content-Length: 64
Authorization: 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 201
Content-Type: application/json
Content-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.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-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.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-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"
}