Staff users, roles and API keys
Generated at build time from packages/core/src/operations/users.ts. Every operation below isPOST /v1/ops/{name} over HTTP, env.API.invoke(actor, name, input) over RPC, and, when staff may call it, an MCP tool. See the API overview for authentication and errors.
users.me
Who am I
The caller's own identity: name, email, role and, for portal users, their account. Also lists the operations the caller may use.
Input (empty object)
No input. Send {}.
Output (object)
| Field | Type | Description |
|---|---|---|
kindrequired | "staff" | "customer" | "agent" | "system" | |
userIdrequired | string | |
emailrequired | string | |
namerequired | string | |
rolerequired | "admin" | "editor" | "viewer" | "customer" | |
accountIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
accountNamerequired | string | null | |
allowedOperationsrequired | string[] |
Example request
curl https://api.cemco.app/v1/ops/users.me \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {}
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"staff",
"customer",
"agent",
"system"
]
},
"userId": {
"type": "string"
},
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer",
"customer"
]
},
"accountId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
{
"type": "null"
}
]
},
"accountName": {
"type": [
"string",
"null"
]
},
"allowedOperations": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"kind",
"userId",
"email",
"name",
"role",
"accountId",
"accountName",
"allowedOperations"
],
"additionalProperties": false
}
}
users.list
List staff users
Cemco staff with access to the CRM, their roles (admin, editor, viewer) and when they were last seen.
Input (object)
| Field | Type | Description |
|---|---|---|
includeInactive | boolean | default false |
Output (object)
| Field | Type | Description |
|---|---|---|
itemsrequired | object[] | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
emailrequired | string (email) | max length 254 |
namerequired | string | |
rolerequired | "admin" | "editor" | "viewer" | |
activerequired | boolean | |
lastSeenAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
Example request
curl https://api.cemco.app/v1/ops/users.list \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"includeInactive": {
"default": false,
"type": "boolean"
}
}
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"email": {
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"active": {
"type": "boolean"
},
"lastSeenAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"email",
"name",
"role",
"active",
"lastSeenAt",
"createdAt",
"updatedAt"
],
"additionalProperties": false
}
}
},
"required": [
"items"
],
"additionalProperties": false
}
}
users.invite
Add a staff user
Give a Cemco colleague access before their first sign-in by adding their work email with a role. The email must be on the staff domain. They sign in with Google or an email code; no password is set here.
Input (object)
| Field | Type | Description |
|---|---|---|
emailrequired | string (email) | max length 254 |
namerequired | string | min length 1, max length 200 |
role | "admin" | "editor" | "viewer" | default "viewer" |
Output (object)
| Field | Type | Description |
|---|---|---|
userrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
emailrequired | string (email) | max length 254 |
namerequired | string | |
rolerequired | "admin" | "editor" | "viewer" | |
activerequired | boolean | |
lastSeenAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
createdrequired | boolean |
Example request
curl https://api.cemco.app/v1/ops/users.invite \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"email":"name@example.com","name":"example"}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"email": {
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"role": {
"default": "viewer",
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
}
},
"required": [
"email",
"name"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"email": {
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"active": {
"type": "boolean"
},
"lastSeenAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"email",
"name",
"role",
"active",
"lastSeenAt",
"createdAt",
"updatedAt"
],
"additionalProperties": false
},
"created": {
"type": "boolean"
}
},
"required": [
"user",
"created"
],
"additionalProperties": false
}
}
users.set_role
Change a staff user's role
Set a staff user's role to admin, editor or viewer. The last active admin cannot be demoted.
Input (object)
| Field | Type | Description |
|---|---|---|
idrequired | string | Record id (UUID)min length 1, max length 64 |
rolerequired | "admin" | "editor" | "viewer" |
Output (object)
| Field | Type | Description |
|---|---|---|
userrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
emailrequired | string (email) | max length 254 |
namerequired | string | |
rolerequired | "admin" | "editor" | "viewer" | |
activerequired | boolean | |
lastSeenAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
Example request
curl https://api.cemco.app/v1/ops/users.set_role \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"id":"00000000-0000-4000-8000-000000000000","role":"admin"}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
}
},
"required": [
"id",
"role"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"email": {
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"active": {
"type": "boolean"
},
"lastSeenAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"email",
"name",
"role",
"active",
"lastSeenAt",
"createdAt",
"updatedAt"
],
"additionalProperties": false
}
},
"required": [
"user"
],
"additionalProperties": false
}
}
users.set_active
Deactivate or reactivate a staff user
Turn a staff user's access off (signing them out everywhere) or back on. The last active admin cannot be deactivated. History and audit entries are kept.
Input (object)
| Field | Type | Description |
|---|---|---|
idrequired | string | Record id (UUID)min length 1, max length 64 |
activerequired | boolean |
Output (object)
| Field | Type | Description |
|---|---|---|
userrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
emailrequired | string (email) | max length 254 |
namerequired | string | |
rolerequired | "admin" | "editor" | "viewer" | |
activerequired | boolean | |
lastSeenAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
Example request
curl https://api.cemco.app/v1/ops/users.set_active \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"id":"00000000-0000-4000-8000-000000000000","active":true}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"active": {
"type": "boolean"
}
},
"required": [
"id",
"active"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"email": {
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"active": {
"type": "boolean"
},
"lastSeenAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"email",
"name",
"role",
"active",
"lastSeenAt",
"createdAt",
"updatedAt"
],
"additionalProperties": false
}
},
"required": [
"user"
],
"additionalProperties": false
}
}
users.update_profile
Update my profile
Change the display name shown for the caller on records, the audit log and emails.
Input (object)
| Field | Type | Description |
|---|---|---|
namerequired | string | min length 1, max length 200 |
Output (object)
| Field | Type | Description |
|---|---|---|
userrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
emailrequired | string (email) | max length 254 |
namerequired | string | |
rolerequired | "admin" | "editor" | "viewer" | |
activerequired | boolean | |
lastSeenAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
Example request
curl https://api.cemco.app/v1/ops/users.update_profile \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"name":"example"}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"required": [
"name"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"email": {
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"name": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"active": {
"type": "boolean"
},
"lastSeenAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"email",
"name",
"role",
"active",
"lastSeenAt",
"createdAt",
"updatedAt"
],
"additionalProperties": false
}
},
"required": [
"user"
],
"additionalProperties": false
}
}
users.list_api_keys
List API keys
API keys issued to agents and scripts, with the role each acts as. Secrets are never shown again after creation.
Input (empty object)
No input. Send {}.
Output (object)
| Field | Type | Description |
|---|---|---|
itemsrequired | object[] | |
idrequired | string | |
namerequired | string | |
prefixrequired | string | |
rolerequired | "admin" | "editor" | "viewer" | |
ownerEmailrequired | string | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
lastUsedAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
expiresAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
revokedrequired | boolean |
Example request
curl https://api.cemco.app/v1/ops/users.list_api_keys \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {}
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"prefix": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"ownerEmail": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"lastUsedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"expiresAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"revoked": {
"type": "boolean"
}
},
"required": [
"id",
"name",
"prefix",
"role",
"ownerEmail",
"createdAt",
"lastUsedAt",
"expiresAt",
"revoked"
],
"additionalProperties": false
}
}
},
"required": [
"items"
],
"additionalProperties": false
}
}
users.create_api_key
Create an API key
Issue an API key for an agent or script that will act with the given staff role. The secret is returned once; store it safely.
Input (object)
| Field | Type | Description |
|---|---|---|
namerequired | string | What the key is for, for example Email filing agentmin length 1, max length 100 |
role | "admin" | "editor" | "viewer" | default "editor" |
expiresInDays | integer | min 1, max 3650 |
Output (object)
| Field | Type | Description |
|---|---|---|
keyrequired | string | The secret; shown only now |
inforequired | object | |
idrequired | string | |
namerequired | string | |
prefixrequired | string | |
rolerequired | "admin" | "editor" | "viewer" | |
ownerEmailrequired | string | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
lastUsedAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
expiresAtrequired | string (date-time) | null | UTC timestamp, ISO 8601 with Z |
revokedrequired | boolean |
Example request
curl https://api.cemco.app/v1/ops/users.create_api_key \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"name":"example"}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "What the key is for, for example Email filing agent"
},
"role": {
"default": "editor",
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"expiresInDays": {
"type": "integer",
"minimum": 1,
"maximum": 3650
}
},
"required": [
"name"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The secret; shown only now"
},
"info": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"prefix": {
"type": "string"
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
},
"ownerEmail": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"lastUsedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"expiresAt": {
"anyOf": [
{
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
{
"type": "null"
}
]
},
"revoked": {
"type": "boolean"
}
},
"required": [
"id",
"name",
"prefix",
"role",
"ownerEmail",
"createdAt",
"lastUsedAt",
"expiresAt",
"revoked"
],
"additionalProperties": false
}
},
"required": [
"key",
"info"
],
"additionalProperties": false
}
}
users.revoke_api_key
Revoke an API key
Stop an API key working immediately. Anything still using the key gets an unauthorized error.
Input (object)
| Field | Type | Description |
|---|---|---|
idrequired | string | min length 1 |
Output (object)
| Field | Type | Description |
|---|---|---|
okrequired | true | |
idrequired | string |
Example request
curl https://api.cemco.app/v1/ops/users.revoke_api_key \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"id":"00000000-0000-4000-8000-000000000000"}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1
}
},
"required": [
"id"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"const": true
},
"id": {
"type": "string"
}
},
"required": [
"ok",
"id"
],
"additionalProperties": false
}
}