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

# Contentful Integration

> Connect HelloLeo to your Contentful CMS

Connect HelloLeo to your Contentful space to manage content, entries, assets, and content models.

## Setup

1. Go to **Project Settings** → **Project Integrations**
2. Select **Contentful** from the list
3. Enter your credentials:
   * **Content Management API (CMA) Token** - Your Contentful CMA token
     * Get it from [Contentful CMA Tokens](https://app.contentful.com/spaces/jzb8rcyqwxov/api/cma_tokens)
4. Test the connection
5. Start using Contentful in your prompts

## How It Works

HelloLeo uses the Contentful MCP (Model Context Protocol) to interact with your Contentful space. Your CMA token is encrypted and stored securely on the backend.

## Environment Variables

When you configure Contentful, the following environment variables are automatically set up:

* `VITE_CONTENTFUL_SPACE_ID` - Your Contentful space ID
* `VITE_CONTENTFUL_ACCESS_TOKEN` - Your Contentful access token

These environment variables allow your frontend code to connect directly to your Contentful space using the Content Delivery API (CDA).

## Common Operations

With Contentful integration, you can:

* **Manage entries** - Create, read, update, and delete content entries
* **Handle assets** - Upload, manage, and retrieve media assets
* **Work with content types** - Access and modify content type definitions
* **Query content** - Search and filter entries using Contentful's query API
* **Publish content** - Publish and unpublish entries

## Example Usage

### Display Entries

```
Show all blog posts from Contentful. Display title, 
publish date, and author.
```

### Create Entry

```
Create a new blog post in Contentful with title "Getting Started", 
content "This is my first post", and publish date today.
```

### Query Content

```
Find all products in Contentful where category is "Electronics". 
Display name, price, and image.
```

### Update Entry

```
Update the blog post with ID "abc123" in Contentful to change 
the title to "Updated Title".
```

### Manage Assets

```
Upload an image to Contentful and attach it to the blog post 
with ID "abc123".
```

## Best Practices

* **Use environment variables** - Reference `VITE_CONTENTFUL_SPACE_ID` and `VITE_CONTENTFUL_ACCESS_TOKEN` in your code
* **Specify content types** - Always mention which content type you're working with (e.g., "blog posts", "products")
* **Mention the integration** - Always say "from Contentful" or "to Contentful" so Leo knows which integration to use
* **Content model** - Be aware of your content model structure and required fields

## Troubleshooting

### Connection Issues

* **Check CMA token** - Verify your Contentful CMA token is correct
* **Token permissions** - Ensure your token has the necessary permissions
* **Space ID** - Verify your Contentful space ID is correct

### Data Not Showing

* **Check content type** - Ensure you're using the correct content type ID or name
* **Published status** - Verify entries are published (CDA only returns published content)
* **Permissions** - Check that your CMA token has read access

### Can't Create/Update

* **Write permissions** - Ensure your CMA token has write permissions
* **Required fields** - Make sure all required fields are provided
* **Content type** - Verify the content type exists and is accessible
* **Data format** - Check that data matches your content type schema

<CardGroup cols={2}>
  <Card title="Working with Integrations" icon="plug" href="/integrations/working-with-integrations">
    Learn how to use integrations effectively
  </Card>

  <Card title="Network Monitor" icon="activity" href="/features/network-monitor">
    Debug Contentful API calls
  </Card>
</CardGroup>
