Prefix
Prefixes define the numbering scheme for items within an organisation. Each prefix has a description, number format, and sequence counter.
Prefix Object
| Field | Type | Description |
|---|---|---|
| id | snowflake | the prefix's unique identifier |
| organisation_id | snowflake | the prefix's organisation id |
| description | string | a description of the prefix |
| number_format | string | the prefix number format template |
| number_digits | integer? | the number of digits to pad the number with zeros |
| last_number | integer | the last assigned number in this prefix sequence |
| unique_number | boolean | whether unique numbering is enforced |
| enabled | boolean | whether the prefix is enabled |
Get Prefix
GET /api/prefixes/{prefix.id}
Returns the prefix object for the given prefix id. Requires membership in the organisation that owns the prefix.
Error Responses
| Status Code | Description |
|---|---|
| 400 | The prefix or organisation was not found |
| 403 | The user is not a member of the organisation |
Update Prefix
PATCH /api/prefixes/{prefix.id}
Updates a prefix. Requires the MANAGE_ORGANISATION permission for the organisation.
All parameters for this method are optional. Only the fields provided will be updated.
Parameters
| Field | Type | Description |
|---|---|---|
| description | string? | a description of the prefix |
| last_number | integer? | the last assigned number; only increases are allowed |
| enabled | boolean? | whether the prefix is enabled |
Notes
number_formatandunique_numberare read-only and cannot be updated. Create a new prefix if a different number format is required.last_numbercan only be increased, never decreased, to avoid number conflicts.
Error Responses
| Status Code | Description |
|---|---|
| 400 | The prefix or organisation was not found |
| 403 | The user lacks the MANAGE_ORGANISATION permission |
Delete Prefix
DELETE /api/prefixes/{prefix.id}
Deletes a prefix. Requires the MANAGE_ORGANISATION permission for the organisation. The prefix must be disabled and have not been used (i.e., enabled is false and last_number is 0).
Error Responses
| Status Code | Description |
|---|---|
| 400 | The prefix or organisation was not found |
| 400 | The prefix is enabled or has been used |
| 403 | The user lacks the MANAGE_ORGANISATION permission |