> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# category

> Returns a single token category by its slug, or null if none matches. Reference for the category query in the Codex API: arguments, response fields, and usage.

Returns a single token category by its slug. Use it to render a category detail page header (name, description) before fetching the category's tokens with [`categoryTokens`](/api-reference/queries/categorytokens). To list all categories, use [`categories`](/api-reference/queries/categories).

<div data-generated>
  ## GraphQL

  ```
  type Query {
    category(
      slug: String!
    ): Category
  }

  enum CategoryType {
    CANONICAL
    NARRATIVE
  }

  enum CategoryStatus {
    DRAFT
    ACTIVE
    ARCHIVED
  }

  type Category {
    id: String!
    name: String!
    shortName: String
    slug: String!
    description: String
    type: CategoryType!
    status: CategoryStatus!
    parentId: String
    memberCount: Int
  }
  ```
</div>

### Example

<a href="/explore" target="_blank" rel="noopener noreferrer">Test this query in the Explorer →</a>

```graphql theme={null}
{
  category(slug: "artificial-intelligence") {
    id
    name
    shortName
    slug
    description
    status
    parentId
  }
}
```

### Usage Guidelines

* The `slug` is the same value as the category `id` and is the value stored on tokens.
* Returns null when no category matches the slug.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.