---
title: "Generate Content"
description: "Generate new content based on a prompt using GPT-4o. Perfect for creating \ninitial drafts, expanding on ideas, or generating content from minimal input.\n\n**Note**: This endpoint is deployed on Cloudflare Workers at `https://ai-notes.customerconnects.app`\n"
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › AI

`POST /api/notes/generate`

Generate new content based on a prompt using GPT-4o. Perfect for creating 
initial drafts, expanding on ideas, or generating content from minimal input.

**Note**: This endpoint is deployed on Cloudflare Workers at `https://ai-notes.customerconnects.app`

## Authentication

Requires one of the following:

- `NoAuth`
- `ApiKeyAuth`, apiKey, in header, header `X-API-Key`, format `API_KEY`

## Header parameters

- `X-Workspace-Id` (`post/api/notes/generate.header.X-Workspace-Id`; string, required) — Workspace ID for data isolation

## Request body

_Required._

- `workspaceId` (`post/api/notes/generate.workspaceId`; integer, required)
  - example `12345`
- `prompt` (`post/api/notes/generate.prompt`; string, required)
  - example `"Write a comprehensive guide about implementing AI chatbots"`
- `noteId` (`post/api/notes/generate.noteId`; string, optional) — Optional note ID for tracking
  - example `"note_123"`
- `options` (`post/api/notes/generate.options`; object, optional)
  - `context` (`post/api/notes/generate.options.context`; string, optional)
    - one of `"note-creation"`, `"technical-documentation"`, `"business-notes"`; example `"technical-documentation"`
  - `maxTokens` (`post/api/notes/generate.options.maxTokens`; integer, optional)
    - min 100; max 1500; example `1000`
  - `temperature` (`post/api/notes/generate.options.temperature`; number, optional)
    - min 0; max 1; example `0.8`

## Example requests

### Basic content generation

```json
{
  "workspaceId": 15213,
  "prompt": "Write a summary about AI in customer service"
}
```

### Advanced with options

```json
{
  "workspaceId": 15213,
  "prompt": "Create a technical implementation guide for chatbot integration",
  "noteId": "note_123",
  "options": {
    "context": "technical-documentation",
    "maxTokens": 1200,
    "temperature": 0.7
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/notes/generate \
  --header 'Content-Type: application/json' \
  --header 'X-Workspace-Id: 15213' \
  --data '
{
  "workspaceId": 15213,
  "prompt": "Write a summary about AI in customer service"
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/notes/generate';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'X-Workspace-Id': '15213'},
  body: JSON.stringify({workspaceId: 15213, prompt: 'Write a summary about AI in customer service'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/notes/generate"

payload = {
    "workspaceId": 15213,
    "prompt": "Write a summary about AI in customer service"
}
headers = {
    "Content-Type": "application/json",
    "X-Workspace-Id": "15213"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Content generated successfully

#### Example

```json
{
  "success": true,
  "content": "# AI Chatbot Implementation Guide\n\nImplementing AI chatbots requires careful planning...",
  "metadata": {
    "tokensUsed": 446,
    "processingTime": 8739,
    "model": "gpt-4o",
    "wordCount": 252
  }
}
```

- `success` (`post/api/notes/generate.response.200.success`; boolean, optional)
  - example `true`
- `content` (`post/api/notes/generate.response.200.content`; string, optional)
  - example `"# AI Chatbot Implementation Guide\n\nImplementing AI chatbots requires careful planning..."`
- `metadata` (`post/api/notes/generate.response.200.metadata`; object, optional)
  - `tokensUsed` (`post/api/notes/generate.response.200.metadata.tokensUsed`; integer, optional)
    - example `446`
  - `processingTime` (`post/api/notes/generate.response.200.metadata.processingTime`; integer, optional)
    - example `8739`
  - `model` (`post/api/notes/generate.response.200.metadata.model`; string, optional)
    - example `"gpt-4o"`
  - `wordCount` (`post/api/notes/generate.response.200.metadata.wordCount`; integer, optional)
    - example `252`

### 400

Request validation failed

#### Example

```json
{
  "error": "Validation failed",
  "details": [
    "string"
  ]
}
```

- `error` (`post/api/notes/generate.response.400.error`; string, optional)
  - example `"Validation failed"`
- `details` (`post/api/notes/generate.response.400.details`; array<string>, optional)

### 401

Authentication required

#### Example

```json
{
  "error": "Authentication required",
  "success": false
}
```

- `error` (`post/api/notes/generate.response.401.error`; string, optional)
  - example `"Authentication required"`
- `success` (`post/api/notes/generate.response.401.success`; boolean, optional)
  - example `false`

### 403

AI features not enabled

#### Example

```json
{
  "success": false,
  "error": "Notes AI features are not enabled for this workspace"
}
```

- `success` (`post/api/notes/generate.response.403.success`; boolean, optional)
  - example `false`
- `error` (`post/api/notes/generate.response.403.error`; string, optional)
  - example `"Notes AI features are not enabled for this workspace"`

### 429

Rate limit exceeded

#### Example

```json
{
  "success": false,
  "error": "Rate limit exceeded. Please try again later."
}
```

- `success` (`post/api/notes/generate.response.429.success`; boolean, optional)
  - example `false`
- `error` (`post/api/notes/generate.response.429.error`; string, optional)
  - example `"Rate limit exceeded. Please try again later."`


Source: https://developer.channelautomations.com/api/post-api-notes-generate/index.md
