# Contentful Graphql

The Contentful GraphQL Content API allows developers to query and deliver content using GraphQL, providing a flexible and efficient way to access content stored in Contentful.

- **Category:** developer tools
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 3
- **Triggers:** 0
- **Slug:** `CONTENTFUL_GRAPHQL`
- **Version:** 20260227_00

## Tools

### Get CMA Token

**Slug:** `CONTENTFUL_GRAPHQL_GET_CMA_TOKEN`

Tool to retrieve a Contentful Management API (CMA) access token. Use when making CMA calls to ensure valid authorization.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### GraphQL Content API Persisted Query

**Slug:** `CONTENTFUL_GRAPHQL_GRAPH_QL_CONTENT_API_PERSISTED_QUERY`

Execute a GraphQL query using Automatic Persisted Queries (APQ). APQ reduces bandwidth by sending only a SHA256 hash instead of the full query text after initial registration. Workflow: 1. First request: Include both sha256_hash and query text to register the query 2. Subsequent requests: Send only sha256_hash and variables - the server uses the cached query Common errors: - PersistedQueryNotFound: Query not cached; include the full query text - PersistedQueryMismatch: Hash doesn't match query text; recompute the hash - UNKNOWN_SPACE: Invalid space_id or access_token for the space

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | No | Full GraphQL query text. Include on first request to register the query; omit on subsequent requests to use cached version by hash only. |
| `version` | integer | No | APQ protocol version. Must be 1. |
| `space_id` | string | Yes | Contentful Space ID. Example: 'cfexampleapi' for the public demo space. |
| `variables` | object | No | Variables for parameterized GraphQL queries. Example: {"limit": 10} |
| `sha256_hash` | string | Yes | SHA256 hash of the exact GraphQL query text (64 hex characters). Compute with: echo -n 'query text' \| sha256sum. Uppercase is auto-converted to lowercase. |
| `access_token` | string | No | Content Delivery API (CDA) access token. Overrides the token in metadata if provided. |
| `environment_id` | string | Yes | Contentful Environment ID. Use 'master' for the default environment. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
