const url = 'https://app.monitorly.cloud/api/v1/workspaces/WORKSPACE_ID/api-tokens';const options = { method: 'POST', headers: { cookie: '__Host-monitorly_session=<__Host-monitorly_session>', 'Content-Type': 'application/json' }, body: '{"expiresAt":"example","name":"example","projectId":"PROJECT_ID","scopes":["checks:read"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.monitorly.cloud/api/v1/workspaces/WORKSPACE_ID/api-tokens \ --header 'Content-Type: application/json' \ --cookie __Host-monitorly_session=<__Host-monitorly_session> \ --data '{ "expiresAt": "example", "name": "example", "projectId": "PROJECT_ID", "scopes": [ "checks:read" ] }'Creates a personal API token with the given scopes, optionally for one project and with an expiry. The token can never do more than its creator can at the time of each request. The value is in this answer only.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The workspace’s id.
Example
WORKSPACE_IDHeader Parameters
Section titled “Header Parameters”Any 1–255 characters, for example a UUID per intended action. A retry with the same key and the same request answers the stored response and creates nothing again; the same key with another request answers 422 request.idempotency_key_reused. Keys are kept for 24 hours.
Request Bodyrequired
Section titled “Request Bodyrequired”object
RFC 3339, in the future; absent: the token does not expire.
1–100 characters, for telling tokens apart.
Confines the token to one project of the workspace; absent: every project its creator sees.
Example
PROJECT_IDAt least one; each at most once.
Responses
Section titled “Responses”The token’s value and its record.
The answer of a creation: token is shown this once and never again.
object
object
OAuth grants: the MCP client they were approved for (a metadata document URL or a registered client id); null for personal tokens. Always sent; optional in the schema because it was added after the first clients.
mly_ and the first 8 random characters of the value.
mly_…; send it as Authorization: Bearer <token>.
Example
{ "apiToken": { "createdBy": "CREATED_BY", "id": "ID", "kind": "pat", "projectId": "PROJECT_ID", "scopes": [ "checks:read" ], "workspaceId": "WORKSPACE_ID" }}Bad Request.
request.malformed: the body or a parameter is not of the expected shaperequest.idempotency_key_invalid: the key is empty or longer than 255 charactersauth.credentials_conflict: the request carries both a session cookie and a token
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Unauthorized.
auth.unauthenticated,auth.session_expired: no session, or it endedtoken.invalid: the token is malformed, unknown, revoked or expired, or its creator left the workspace
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Forbidden.
auth.forbidden: your role is too low for thistoken.not_allowed: this operation needs a signed-in session; tokens cannot call itrequest.origin_mismatch,request.header_required: a changing request with a session comes from another site or lacksX-Monitorly-Request: 1
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Not Found.
request.not_found: it does not exist, or you cannot see it
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Conflict.
quota.api_tokens_reached: the workspace has 20 active API tokens
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Payload Too Large.
request.too_large: the body is larger than 256 KiB
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Unprocessable Entity.
field.required,field.too_long,field.invalid: a field breaks a rule;errorspoints at it
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Too Many Requests.
session.rate_limited: more than 5 changes a second from your sessions
object
Field errors, empty for errors of the whole request.
object
object
JSON pointer into the request body.
Stable code, for example check.timeout_exceeds_interval.
Example generated
{ "detail": "example", "errors": [ { "code": "example", "params": { "additionalProperty": "example" }, "pointer": "example" } ], "status": 1, "title": "example", "type": "example"}Headers
Section titled “Headers”Seconds to wait before trying again.