Change an automation token's scopes

Add MCP server to your AI tool

Allow AI tools and LLMs to interact with the API documentation portal through MCP.

MCP server URL

https://docs.usehearsay.com/mcp

Standard setup for AI tools providing an mcp.json file

mcp.json
{
  "integrations MCP server": {
    "url": "https://docs.usehearsay.com/mcp"
  }
}

Close
PATCH /auth/tokens/{id}/scopes

Replaces the scopes of one of the caller's automation tokens (duplicates removed; an empty list disables the token without deleting it) and returns the updated token. Returns 403 while automation tokens are turned off, 400 for an unsupported scope and 404 when the id is not one of the caller's automation tokens.

Path parameters

  • id string Required

    Automation token (session) id

application/json

Body Required

  • scopes array[string] Required

    New scope set for the token. Must be a subset of the allowed scopes. Empty array disables the token.

    Values are cases:create, codes:create, or exports:create.

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • data object Required
      Hide data attributes Show data attributes object
      • createdAt string(date-time) Required
      • updatedAt string(date-time) Required
      • id string Required
      • label string
      • scopes array[string] Required

        Values are cases:create, codes:create, or exports:create.

      • lastUsed string(date-time)
      • validTill string(date-time)
      • isRevoked boolean Required
    • statusCode number Required
    • timestamp string(date-time) Required
PATCH /auth/tokens/{id}/scopes
curl \
 --request PATCH 'http://api.example.com/auth/tokens/{id}/scopes' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "scopes": [
    "cases:create"
  ]
}'
Request examples
{
  "scopes": [
    "cases:create"
  ]
}
Response examples (200)
{
  "data": {
    "createdAt": "2026-01-15T14:30:00.000Z",
    "updatedAt": "2026-01-15T14:30:00.000Z",
    "id": "507f1f77bcf86cd799439011",
    "label": "Intake automation",
    "scopes": [
      "cases:create",
      "codes:create"
    ],
    "lastUsed": "2026-01-15T14:30:00.000Z",
    "validTill": "2027-01-15T14:30:00.000Z",
    "isRevoked": false
  },
  "statusCode": 200,
  "timestamp": "2026-01-15T10:15:00.000Z"
}