Create an API resource

POST /api/resources

Create an API resource in the current tenant.

application/json

Body Required

  • tenantId string

    Maximum length is 21.

  • name string Required

    The name of the resource.

    Minimum length is 1.

  • indicator string Required

    The unique resource indicator. Should be a valid URI.

    Minimum length is 1.

  • The access token TTL in seconds. It affects the exp claim of the access token granted for this resource.

    Default value is 3600.

Responses

  • 201 application/json

    The created resource.

    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.

    • name string Required

      Minimum length is 1.

    • indicator string Required

      Minimum length is 1.

    • isDefault boolean Required
    • accessTokenTtl number Required
    • scopes array[object]
      Hide scopes attributes Show scopes 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

  • Unprocessable Content

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