List workspaces, or create one with POST. derived from route
URL
- User APIhttps://contracts.mattering.io/api/user/v1/workspaces/
- Service tierhttps://contracts.mattering.io/api/internal/workspaces/
Query parameters
| Name | Default |
|---|---|
space_id | none |
Body keys (JSON)
| Key | Required | Default |
|---|---|---|
color | optional or conditional | none |
description | optional or conditional | none |
name | optional or conditional | none |
Keys the view reads. A key not in this list is ignored by the view. Where a key is required only for some actions (for example the action dispatch), the description above says which.
Responses
200 bare JSON object (no envelope)
{
"workspaces": [
{
"id": "...",
"name": "...",
"slug": "...",
"color": "...",
"is_active": true,
"space_id": "...",
"workspace_public_id": "..."
}
]
}
201 bare JSON object (no envelope)
{
"workspace": {
"id": "...",
"name": "...",
"slug": "...",
"color": "...",
"is_active": true,
"space_id": "...",
"workspace_public_id": "..."
}
}
Field names come from the code; values are placeholders (... is a string, 0 a number, dates are ISO 8601).
Errors
| Status | Code |
|---|---|
| 400 | name_required |
| 400 | no_org_context |
| 401 | unauthorized |
Example
curl -X POST "https://contracts.mattering.io/api/user/v1/workspaces/" \
-H "Authorization: Bearer $MATTERING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"color": "...",
"description": "...",
"name": "..."
}'curl -X POST "https://contracts.mattering.io/api/internal/workspaces/" \
-H "X-Internal-Secret: $MATTERING_INTERNAL_API_SECRET" \
-H "X-Internal-Org-Id: $ORG_ID" \
-H "X-Internal-User-Email: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"color": "...",
"description": "...",
"name": "..."
}'
Source: ContractsCore/internal_api.py (internal_api.workspaces)