Create a label
Create a label in a tenant.
POST /organizations/{org}/tenants/{tenantId}/labels
Creates a label with no one in it. Apply it to members with Apply a label to a member.
Authorization
Org owner. A member who is not an owner gets 403 forbidden; a non-member gets 404.
Path parameters
| Name | Type | Description |
|---|---|---|
org | string | The organization: its id (org_…) or its slug. It has to be an org your token can manage (see Who can call it) |
tenantId | string | The tenant, tnt_… |
Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | 1–64 characters, trimmed |
color | string | no | indigo, blue, emerald, amber, rose, violet, teal or orange. Default indigo |
icon | string | no | A Heroicons name: a-z, 0-9 and -, up to 64 characters. Default user-group |
description | string | no | Up to 280 characters. Default "" |
No other field is accepted.
Response
201 Created with the label.
{
"id": "lbl_65f1c2a9e4b0d3f7a1c8e90a",
"tenant_id": "tnt_65f1c2a9e4b0d3f7a1c8e908",
"name": "Finance",
"color": "emerald",
"icon": "banknotes",
"description": "",
"members": []
}
Errors
| Status | error | When |
|---|---|---|
400 | invalid_request | An unknown field, or a value that fails validation. The detail names it |
403 | forbidden | You are a member of the org but not an owner |
404 | not_found | No such tenant in this org, or the org is not yours |
Example
curl -X POST https://loginwith.loginwith.dev/organizations/acme/tenants/tnt_65f1c2a9e4b0d3f7a1c8e908/labels \
-H "Authorization: Bearer $TOKEN" -H "content-type: application/json" \
-d '{"name": "Finance", "color": "emerald", "icon": "banknotes"}'