Create API resource scope

POST /api/resources/{resourceId}/scopes

Create a new scope (permission) for an API resource.

Path parameters

  • resourceId string Required

    The unique identifier of the resource.

application/json

Body Required

  • name string Required

    The name of the scope. It should be unique for the resource.

    Minimum length is 1, maximum length is 256.

  • description string | null

Responses

  • 201 application/json

    The created scope.

    Hide response attributes Show response attributes object
    • tenantId string Required

      Maximum length is 21.

    • id string Required

      Minimum length is 1, maximum length is 21.

    • resourceId string Required

      Minimum length is 1, maximum length is 21.

    • name string Required

      Minimum length is 1, maximum length is 256.

    • description string | null Required
    • createdAt number Required
  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Unprocessable Content

POST /api/resources/{resourceId}/scopes
curl \
 -X POST https://[tenant_id].logto.app/api/resources/{resourceId}/scopes \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"name":"string","description":"string"}'
Request examples
{
  "name": "string",
  "description": "string"
}
Response examples (201)
{
  "tenantId": "string",
  "id": "string",
  "resourceId": "string",
  "name": "string",
  "description": "string",
  "createdAt": 42.0
}