Skip to main content
PATCH
/
api
/
services
/
[id]
Update Service
curl --request PATCH \
  --url 'https://api.example.com/api/services/[id]' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "email": "<string>",
  "color": "<string>",
  "signature": "<string>",
  "document": "<string>",
  "categories": [
    {
      "categories[].id": "<string>",
      "categories[].name": "<string>",
      "categories[].color": "<string>",
      "categories[].textColor": "<string>"
    }
  ]
}
'
{
  "ok": true
}
Updates an existing service account’s configuration. Supports partial updates and category management.

Authentication

Requires a valid session. User must be authenticated via NextAuth.

Path parameters

id
string
required
The unique identifier of the service to update

Request body

All fields are optional. Only provided fields will be updated.
name
string
Updated display name for the service
email
string
Updated Gmail email address
color
string
Updated hex color code for UI display
signature
string
Updated email signature for outbound messages
document
string
Updated documentation or notes
categories
array
Array of category objects to replace existing categories

Response

ok
boolean
required
Always true on successful update

Response examples

{
  "ok": true
}

Code examples

curl --request PATCH \
  --url 'https://your-domain.com/api/services/service-123' \
  --cookie 'authjs.session-token=YOUR_SESSION_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Updated Support Team",
    "color": "#ff6b6b",
    "categories": [
      {
        "id": "cat-urgent",
        "name": "Urgent",
        "color": "#ff6b6b",
        "textColor": "#ffffff"
      }
    ]
  }'

Implementation details

Allowed fields

Only these fields can be updated:
  • name
  • email
  • color
  • signature
  • document
Any other fields in the request body are ignored.

Category management

When categories array is provided:
  1. All existing categories for the service are deleted
  2. New categories from the request are inserted
  3. Each category is linked to the service via accountId
  4. Empty array removes all categories
Updating categories replaces ALL existing categories. Include all categories you want to keep in the request.

Validation

  • Service ID must exist in the database
  • At least one field must be provided (empty PATCH is allowed but does nothing)
  • Category objects must include all required fields: id, name, color, textColor
This endpoint does not return the updated service object. Use GET /api/services to retrieve the updated data.

Build docs developers (and LLMs) love