Update the current user’s tenant name and/or slug. Requires a valid JWT access token. The tenant is resolved from the authenticated user — no tenant ID is needed in the URL.
- Both
nameandslugare required in the request body. - The
slugmust be unique across all tenants in the system. - The
slugmust be lowercase alphanumeric characters and hyphens only (pattern:^[a-z0-9-]+$). - Only the tenant owner can update the tenant.
- Returns the full updated tenant on success.
sequenceDiagram
actor User
User->>+FE: fills Tenant Settings form
FE->>FE: validate form
alt form is invalid
FE-->>User: show error messages <br> disable submit button
end
User->>FE: submits Tenant Settings form
FE->>+BE: PUT /api/v1/tenant <br> Authorization: Bearer {accessToken} <br> UpdateTenantRequest
BE->>BE: validate request
alt request is invalid
BE-->>FE: 400 Bad Request <br> ErrorResponse
end
BE->>BE: resolve tenant from JWT
alt access token missing or invalid
BE-->>FE: 401 Unauthorized <br> ErrorResponse
end
BE->>DB: check if slug is taken by another tenant
alt slug already taken
BE-->>FE: 409 Conflict <br> ErrorResponse
end
BE->>DB: UPDATE tenant SET name, slug, updated_at
BE->>-FE: 200 OK <br> TenantResponse
FE->>-User: show success message, display updated settings
PUT /api/v1/tenant UpdateTenantRequest:
{
"name": "Míra's Studio",
"slug": "mira-studio"
}
200 OK TenantResponse:
{
"data": {
"id": 1,
"name": "Míra's Studio",
"slug": "mira-studio",
"createdAt": "2026-04-01T08:00:00Z",
"updatedAt": "2026-04-29T10:00:00Z"
}
}
400 Bad Request (validation) ErrorResponse:
{
"status": 400,
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"errors": [
{ "field": "slug", "message": "must match ^[a-z0-9-]+$" }
]
}
401 Unauthorized (missing or invalid access token) ErrorResponse:
{
"status": 401,
"code": "AUTHENTICATION_FAILED",
"message": "Access token is missing or invalid"
}
409 Conflict (slug already taken) ErrorResponse:
{
"status": 409,
"code": "CONFLICT_TENANT",
"message": "Slug is already taken by another tenant"
}
Frontend
Validations
| Field | Constraints | Size | Pattern | Note |
|---|---|---|---|---|
| name | not_blank | 1 - 100 | ||
| slug | not_blank | 1 - 50 | ^[a-z0-9-]+$ | Lowercase alphanumeric and hyphens only |
Backend
Validations
| Field | Constraints | Size | Pattern | Note |
|---|---|---|---|---|
| name | not_blank | 1 - 100 | ||
| slug | not_blank | 1 - 50 | ^[a-z0-9-]+$ | Must be unique across all tenants |
Test Cases
| GIVEN | WHEN | THEN |
|---|---|---|
| authenticated user, valid name and slug (slug unchanged) | PUT /tenant is called | 200 OK with updated tenant returned |
| authenticated user, valid name and new unique slug | PUT /tenant is called | 200 OK with updated tenant returned |
| authenticated user, slug already taken by another tenant | PUT /tenant is called | 409 CONFLICT_TENANT error response is returned |
| name is blank | PUT /tenant is called | 400 VALIDATION_ERROR error response is returned |
| name longer than 100 characters | PUT /tenant is called | 400 VALIDATION_ERROR error response is returned |
| slug is blank | PUT /tenant is called | 400 VALIDATION_ERROR error response is returned |
| slug longer than 50 characters | PUT /tenant is called | 400 VALIDATION_ERROR error response is returned |
| slug contains uppercase characters | PUT /tenant is called | 400 VALIDATION_ERROR error response is returned |
| slug contains spaces or special characters | PUT /tenant is called | 400 VALIDATION_ERROR error response is returned |
| invalid request (empty body) | PUT /tenant is called | 400 VALIDATION_ERROR error response is returned |
| no Authorization header | PUT /tenant is called | 401 AUTHENTICATION_FAILED error response is returned |
| expired access token | PUT /tenant is called | 401 AUTHENTICATION_FAILED error response is returned |
Was this page helpful?
Thanks for the feedback.