> 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.

# Publish an AI action

PUT https://api.contentful.com/spaces/{space_id}/environments/{environment_id}/ai/actions/{ai_action_id}/published

Use this endpoint to publish an AI Action for a specified space.

Reference: https://contentful.com/developers/docs/references/content-management-api/ai-actions/publish-an-ai-action

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `space_id` (string, required) — ID of the space in the form of a string
- `environment_id` (string, required) — ID of the environment in the form of a string
- `ai_action_id` (string, required) — ID of the AI Action in form of a string

### Headers

- `X-Contentful-Version` (string, required) — Version of the AI Action to publish

## Response

### 200

OK - Request successful

- `map from string to any`

## Examples

**Response**

```json
{
  "configuration": {
    "modelTemperature": 0.1,
    "modelType": "anthropic.claude-3-5-sonnet"
  },
  "description": "Convert text to another language.",
  "instruction": {
    "template": "You are an expert in translating text to {{var.t82kaxhw0s13}}. Your task is to convert the provided content to the specified language while maintaining the original message and intent.",
    "variables": [
      {
        "description": "Target language or region for the translation.",
        "name": "Locale",
        "type": "Locale"
      }
    ]
  },
  "name": "Translate",
  "sys": {
    "createdAt": "2025-03-27T09:27:43.654Z",
    "createdBy": {
      "sys": {
        "id": "1xGZIRXr2WPnsLkKfREo0z",
        "linkType": "User",
        "type": "Link"
      }
    },
    "id": "3D5GGn5FlhszToS2Sbkfk8",
    "publishedAt": "2025-03-27T09:39:33.032Z",
    "publishedBy": {
      "sys": {
        "id": "1xGZIRXr2WPnsLkKfREo0z",
        "linkType": "User",
        "type": "Link"
      }
    },
    "publishedVersion": 1,
    "space": {
      "sys": {
        "id": "yadj1kx9rmg0",
        "linkType": "Space",
        "type": "Link"
      }
    },
    "type": "AiAction",
    "updatedAt": "2025-03-27T09:39:33.032Z",
    "updatedBy": {
      "sys": {
        "id": "1xGZIRXr2WPnsLkKfREo0z",
        "linkType": "User",
        "type": "Link"
      }
    },
    "version": 1
  },
  "testCases": [
    {
      "type": "Text",
      "value": "This is an example text"
    }
  ]
}
```

**SDK Code**

```android Android
SDK currently doesn't implement this endpoint.
```

```java Java
SDK currently doesn't implement this endpoint.
```

```kotlin Kotlin
SDK currently doesn't implement this endpoint.
```

```swift Swift
We currently don't provide a CMA SDK for this platform.
```

```js-legacy JavaScript (legacy)
import { createClient } from 'contentful-management'

const client = createClient({
  accessToken: '<content_management_api_key>'
}, { type: 'legacy' })

client.getSpace('<space_id>')
.then((space) => space.publishAiAction('<ai_action_id>', {
    version: '<ai_action_version>'
}))
.then(() => console.log('AiAction published.'))
.catch(console.error)
```

```javascript JavaScript
import { createClient } from 'contentful-management'

// Client init
const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

await client.aiAction.publish({
  spaceId: '<space_id>',
  aiActionId: '<ai_action_id>',
  version: '<ai_action_version>'
});
```

```php PHP
SDK currently doesn't implement this endpoint.
```

```ruby Ruby
SDK currently doesn't implement this endpoint.
```

```python Python
SDK currently doesn't implement this endpoint.
```

```.net .NET
SDK currently doesn't implement this endpoint.
```