docs(swagger): document account label endpoints (#13760)

Documents the missing account-level label CRUD endpoints in Chatwoot's
Swagger output so label management is discoverable alongside the
existing contact and conversation label APIs.

Fixes: none
Closes: none

Why
The account-level label API already exists in Chatwoot, but it was
missing from the published Swagger spec. That made label management
harder to discover even though contact and conversation label assignment
endpoints were already documented.

What this change does
- adds a `Labels` tag to the application Swagger docs
- adds the label resource and create/update payload schemas
- documents `GET/POST /api/v1/accounts/{account_id}/labels`
- documents `GET/PATCH/DELETE /api/v1/accounts/{account_id}/labels/{id}`
- regenerates the compiled Swagger JSON artifacts

Validation
- rebuilt the Swagger JSON from the source YAML
- verified the new label endpoints appear in `swagger/swagger.json`
- verified the new label endpoints appear in
`swagger/tag_groups/application_swagger.json`
- started the local Rails server and confirmed `/swagger` and
`/swagger/swagger.json` return `200 OK`
This commit is contained in:
Sojan Jose
2026-03-10 22:24:16 -07:00
committed by GitHub
parent 9a9398b386
commit fdc326094a
16 changed files with 940 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
tags:
- Labels
operationId: create-a-label
summary: Create a label
security:
- userApiKey: []
description: Create a label in the account
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/label_create_update_payload'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/label'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -0,0 +1,22 @@
tags:
- Labels
operationId: delete-a-label
summary: Delete a label
security:
- userApiKey: []
description: Delete a label from the account
responses:
'200':
description: Success
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: The label does not exist in the account
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -0,0 +1,26 @@
tags:
- Labels
operationId: list-all-labels
summary: List all labels
security:
- userApiKey: []
description: List all labels available in the current account
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
payload:
type: array
description: Array of labels
items:
$ref: '#/components/schemas/label'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -0,0 +1,26 @@
tags:
- Labels
operationId: get-details-of-a-single-label
summary: Get a label
security:
- userApiKey: []
description: Get the details of a label in the account
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/label'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: The given label ID does not exist in the account
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -0,0 +1,26 @@
tags:
- Labels
operationId: update-a-label
summary: Update a label
security:
- userApiKey: []
description: Update a label's attributes
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/label_create_update_payload'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/label'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -438,6 +438,30 @@
delete:
$ref: ./application/inboxes/inbox_members/delete.yml
# Labels
/api/v1/accounts/{account_id}/labels:
parameters:
- $ref: '#/components/parameters/account_id'
get:
$ref: ./application/labels/index.yml
post:
$ref: ./application/labels/create.yml
/api/v1/accounts/{account_id}/labels/{id}:
parameters:
- $ref: '#/components/parameters/account_id'
- name: id
in: path
required: true
schema:
type: number
description: ID of the label
get:
$ref: ./application/labels/show.yml
patch:
$ref: ./application/labels/update.yml
delete:
$ref: ./application/labels/delete.yml
# Messages
/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages:
parameters: