> ## Documentation index
>
> Fetch the complete documentation index at: https://andesine.app/docs/llms.txt
> Use it to find all pages before you explore further.

# Get collection schemas

`GET https://api.andesine.app/schemas/collection`

Returns local and effective schema details for the collection, including inheritance.

Required API key permissions: read:collections. Write permissions also grant read access for the same resource.

## Authentication

Use one of:

- `apiKey` (http, bearer, Andesine API key)
- `oauth` (http, bearer, Andesine OAuth access token)

## Parameters

### Query

- `collectionID` (string, optional)
- `collectionPath` (string, optional): Decoded content path, such as /Docs/Page or coll_ID/Page. Names are case-sensitive. Do not URL-encode names before passing them to the SDK.
- `collectionSlugPath` (string, optional): Decoded derived slug path, such as /docs/getting-started or coll_ID/getting-started. Use the returned slugPath without URL encoding.

### Header

- `x-workspace-id` (string, optional): Required for OAuth: ID of the workspace to access. API keys use their own workspace.

## Responses

### 200

OK

Content type: `application/json`

Type: `CollectionSchema`.

- `local` (any of, required)
  - Any of: `LocalCollectionSchema`
    - `id` (string, required): ID of the local collection schema.
    - `collectionID` (string, required): ID of the collection.
    - `enabled` (boolean, required): Whether the collection currently defines a local schema.
    - `draft` (any of, required): Current local schema draft.
      - Any of: `SchemaDraftDefinition`
        - `formatVersion` (constant, required): Value: `1`.
        - `fields` (array of `SchemaField`, required)
          - Any of: `SchemaProperty`
            - `id` (string, required)
            - `kind` (constant, required): Value: `"property"`.
            - `label` (string, required)
            - `type` (string, required): One of: `"text"`, `"number"`, `"checkbox"`, `"date"`, `"url"`, `"select"`, `"multi-select"`.
            - `initialValue` (`SchemaPropertyValue`, required)
              - Any of: Option 1 (boolean)
              - Any of: Option 2 (string)
              - Any of: Option 3 (array of string)
            - `options` (array of string, required)
            - `optional` (boolean, optional)
          - Any of: `SchemaFragment`
            - `id` (string, required)
            - `kind` (constant, required): Value: `"fragment"`.
            - `label` (string, required)
            - `allowedBlocks` (array of `SchemaBlockType`, required)
            - `initialContent` (array of `ContentNode`, required)
              - `type` (string, required)
              - `attrs` (object, optional)
                - `{key}` (any, optional)
              - `content` (array of `ContentNode`, optional)
              - `marks` (array of `ContentMark`, optional)
                - `type` (string, required)
                - `attrs` (object, optional)
                  - `{key}` (any, optional)
              - `text` (string, optional)
            - `optional` (boolean, optional)
      - Any of: Option 2 (null)
    - `draftDocument` (any of, required): Current draft projected as an editor document.
      - Any of: `ContentNode`
      - Any of: Option 2 (null)
    - `draftHash` (any of, required): Hash of the current local schema draft.
      - Any of: Option 1 (string)
      - Any of: Option 2 (null)
    - `hasUnappliedChanges` (boolean, required): Whether the draft differs from the active version.
    - `activeVersion` (any of, required)
      - Any of: `SchemaVersionSummary`
        - `id` (string, required): ID of the schema version.
        - `schemaID` (string, required): ID of the local collection schema.
        - `collectionID` (string, required): ID of the collection.
        - `version` (number, required): Sequential schema version number.
        - `hash` (string, required): Hash of the schema definition.
        - `name` (any of, required): Optional schema version name.
          - Any of: Option 1 (string)
          - Any of: Option 2 (null)
        - `reason` (string, required): Reason why the schema version was created. One of: `"auto"`, `"manual"`, `"revert"`, `"schema-migration"`, `"import"`.
        - `sourceVersionID` (any of, required): Source version used for a revert.
          - Any of: Option 1 (string)
          - Any of: Option 2 (null)
        - `active` (boolean, required): Whether this is the active local schema version.
        - `appliedBy` (any of, required): Membership that applied the schema version.
          - Any of: Option 1 (string)
          - Any of: Option 2 (null)
        - `contributorIDs` (array of string, required): Memberships that contributed to the schema version.
        - `createdAt` (string, required): Time when the schema version was created.
        - `updatedAt` (string, required): Time when the schema version name was last updated.
      - Any of: Option 2 (null)
    - `createdAt` (string, required): Time when the local schema was first created.
    - `updatedAt` (string, required): Time when the local schema draft was last updated.
  - Any of: Option 2 (null)
- `effective` (any of, required)
  - Any of: `EffectiveCollectionSchema`
    - `id` (string, required): ID of the effective schema revision.
    - `collectionID` (string, required): ID of the collection.
    - `definition` (object, required): Effective inherited schema definition.
      - `formatVersion` (constant, required): Value: `1`.
      - `fields` (array of `ResolvedSchemaField`, required)
        - `source` (`SchemaFieldSource`, required)
          - `collectionID` (string, required)
          - `inherited` (boolean, required)
          - `schemaID` (string, required)
          - `versionID` (string, required)
      - `sourceVersionIDs` (array of string, required)
    - `document` (object, required): Effective schema projected as an editor document.
      - `type` (string, required)
      - `attrs` (object, optional)
        - `{key}` (any, optional)
      - `content` (array of `ContentNode`, optional)
      - `marks` (array of `ContentMark`, optional)
      - `text` (string, optional)
    - `hash` (string, required): Hash of the effective schema definition.
    - `inherited` (boolean, required): Whether the effective schema is fully inherited.
    - `createdAt` (string, required): Time when the effective revision was created.
  - Any of: Option 2 (null)

### 400

400

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"BAD_REQUEST"`.
  - `status` (constant, required): Value: `400`.
  - `message` (string, required): Default: `"Bad Request"`.
  - `data` (`ValidationErrorData`, optional)
    - `hints` (array of string, optional): Suggested next steps. Wording can change; use error codes and structured data for program logic.
    - `issues` (array of `ValidationIssue`, optional)
      - `message` (string, required)
      - `code` (string, optional)
      - `path` (array of any of, optional)
        - Any of: Option 1 (string)
        - Any of: Option 2 (number)
        - Any of: Option 3 (object)
          - `key` (any of, required)
            - Any of: Option 1 (string)
            - Any of: Option 2 (number)
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)

### 401

401

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"UNAUTHORIZED"`.
  - `status` (constant, required): Value: `401`.
  - `message` (string, required): Default: `"Unauthorized"`.
  - `data` (`ErrorData`, optional)
    - `hints` (array of string, optional): Suggested next steps. Wording can change; use error codes and structured data for program logic.
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)

### 403

403

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"FORBIDDEN"`.
  - `status` (constant, required): Value: `403`.
  - `message` (string, required): Default: `"Forbidden"`.
  - `data` (`ForbiddenErrorData`, optional)
    - `hints` (array of string, optional): Suggested next steps. Wording can change; use error codes and structured data for program logic.
    - `missingPermissions` (array of string, optional)
    - `requiredPlan` (constant, optional): Value: `"pro"`.
    - `action` (string, optional): The requested action that was denied.
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)

### 404

404

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"NOT_FOUND"`.
  - `status` (constant, required): Value: `404`.
  - `message` (string, required): Default: `"Not Found"`.
  - `data` (`ErrorData`, optional)
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)

### 409

409

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"CONFLICT"`.
  - `status` (constant, required): Value: `409`.
  - `message` (string, required): Default: `"Conflict"`.
  - `data` (`ErrorData`, optional)
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)

### 429

429

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"TOO_MANY_REQUESTS"`.
  - `status` (constant, required): Value: `429`.
  - `message` (string, required): Default: `"Too Many Requests"`.
  - `data` (`RateLimitErrorData`, optional)
    - `hints` (array of string, optional): Suggested next steps. Wording can change; use error codes and structured data for program logic.
    - `limit` (string, optional): The limit that was reached: a short-term rate limit, or a monthly API call, AI credit, or spending limit. One of: `"rate"`, `"api-calls"`, `"ai-credits"`, `"spending"`.
    - `retryAfterSeconds` (number, optional): Minimum delay before another attempt, in seconds. Also sent in Retry-After.
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)

### 500

500

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"INTERNAL_SERVER_ERROR"`.
  - `status` (constant, required): Value: `500`.
  - `message` (string, required): Default: `"Internal Server Error"`.
  - `data` (`ErrorData`, optional)
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)

### 503

503

Content type: `application/json`

Type: one of.

- One of: Option 1 (object)
  - `defined` (constant, required): Value: `true`.
  - `code` (constant, required): Value: `"SERVICE_UNAVAILABLE"`.
  - `status` (constant, required): Value: `503`.
  - `message` (string, required): Default: `"Service Unavailable"`.
  - `data` (`ErrorData`, optional)
- One of: Option 2 (object)
  - `defined` (constant, required): Value: `false`.
  - `code` (string, required)
  - `status` (number, required)
  - `message` (string, required)
  - `data` (any, optional)
