> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

# Extension management with the Contentful CLI

> These commands will help you manage extensions in Contentful. Creating a new extension, getting a list of all available and deleting extensions.

These commands will help you manage extensions in Contentful.

## Requirements

* A (free) [Contentful account](https://www.contentful.com/sign-up/)
* Locally [installed](/tutorials/cli/installation) `contentful-cli`
* [Authenticated](/tutorials/cli/authentication) with `contentful-cli`

## List available commands and their description

```bash
contentful extension --help
```

## Create a new extension

```bash
contentful extension create --space-id xxx --id test --name "Test Extension" --field-types Symbol --src https://new.extension
```

Create an extension using `srcdoc` with automatically assigned ID and two field types:

```bash
contentful extension create --space-id xxx --field-types Symbol --field-types Text --srcdoc ./bundle.html
```

When using the `srcdoc` property, an extension is considered internally hosted. A file being pointed by the `srcdoc` property will be loaded and uploaded as a string to Contentful. All local dependencies have to be manually inlined into the file. The command line tool does not take care of link resolving and inlining of referenced local resources. The maximum size of a file used with the `srcdoc` property is `512kB`.

Create an extension using `./extension.json` descriptor file and provide installation parameter:

> Examples of `extension.json` files and extensions in general can be found [here](https://github.com/contentful/extensions/tree/master/samples).

```bash
contentful extension create --space-id xxx --installation-parameters '{"devMode": true}'
```

## Get a list of all available extensions

Lists all available extensions from a space.

```bash
contentful extension list --space-id xxx
```

*The output should look similar to this:*

```bash
┌────────────────┬──────────────┬──────────────┐
│ Extension Name │ Extension ID │ Version      │
├────────────────┼──────────────┼──────────────┤
│ Test           │ test         │ 3            │
└────────────────┴──────────────┴──────────────┘
```

## Delete an extension

Deletes an extension from a space.

```bash
contentful extension delete --space-id xxx --id test
```

*The output should look similar to this:*

```bash
Successfully deleted extension with ID test
```

## Get an extension

Prints information about the requested extension.

```bash
contentful extension get --space-id xxx --id test
```

*The output should look similar to this:*

```bash
┌─────────────┬───────────────────────────┐
│ Property    │ Value                     │
├─────────────┼───────────────────────────┤
│ ID          │ test                      │
├─────────────┼───────────────────────────┤
│ Name        │ Test Extension            │
├─────────────┼───────────────────────────┤
│ Field types │ Symbol                    │
├─────────────┼───────────────────────────┤
│ Src         │ https://awesome.extension │
├─────────────┼───────────────────────────┤
│ Version     │ 1                         │
└─────────────┴───────────────────────────┘
```

## Update an extension

Update an extension without providing its current version:

```shell
contentful extension update --space-id xxx --id test --name "Test Extension" --field-types Symbol --src https://new.extension --force
```

Update an extension using `srcdoc` and two field types:

```shell
contentful extension update --space-id xxx --id test --field-types Symbol --field-types Text --srcdoc ./bundle.html --version 2
```

Update an extension using `./extension.json` descriptor file and provide installation parameter:

```shell
contentful extension update --space-id xxx --installation-parameters '{"devMode": true}' --force
```

## Next steps

* [Scripting migrations with the Contentful CLI](/tutorials/cli/scripting-migrations/)
* [Check out the documentation in the GitHub repository](https://github.com/contentful/contentful-cli/tree/master/docs/extension)