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

# Create AOP

POST https://api.athenaintel.com/api/v0/aop/create
Content-Type: application/json

Create a new AOP (Agent Operating Procedure) asset with the given configuration. The created AOP can then be executed via /aop/execute-async, inspected via /aop/\{asset\_id}/config, and updated via PUT /aop/\{asset\_id}/config. Use \[\[ placeholder ]] syntax in the prompt for user inputs supplied at execution time.

Reference: https://docs.athenaintel.com/api-reference/aop/create

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects an AOPCreateRequestIn.

- `agentId` (string, optional, nullable) — ID of the agent to use for execution
- `agent_config` (map from string to any, optional, nullable) — Full agent configuration override for this AOP
- `description` (string, optional, nullable) — Human-readable description of what the AOP does
- `icon` (string, optional, nullable) — Icon identifier for UI display
- `is_hidden` (boolean, optional, nullable) — Create the AOP hidden: it keeps its asset_id and stays reachable by id, but is left out of the Library, search and the AOP pickers. Meant for fixtures and smoke tests seeded into a shared workspace; omit it for user-facing AOPs.
- `parent_folder_id` (string, optional, nullable) — ID of the folder to create the AOP in (workspace root if omitted)
- `prompt` (string, optional, nullable) — The main prompt/instructions for the AOP. Use [[ placeholder ]] syntax for user inputs supplied at execution time
- `section` (string, optional, nullable) — Section/category for organization
- `structured_output` (map from string to any, optional, nullable) — JSON schema for structured output
- `title` (string, optional, nullable) — Title of the AOP (defaults to 'Untitled AOP')
- `user_notification_configs` (map from string to map from string to any, optional, nullable) — Per-user notification preferences. Map of user_id -> notification config controlling who receives AOP result notifications
- `workspace_id` (string, optional, nullable) — ID of the workspace to create the AOP in. If not provided, the parent folder's workspace is used when parent_folder_id is provided; otherwise the AOP is created in the user's current workspace. The user must be a member of the specified workspace.

## Response

### 200

AOP created successfully

- `asset_id` (string, required) — ID of the newly created AOP asset
- `title` (string, required) — Title of the created AOP
- `message` (string, optional, default: AOP created successfully) — Human-readable status message
- `parent_folder_id` (string, optional, nullable) — ID of the parent folder
- `status` (string, optional, default: created) — Status of the operation
- `workspace_id` (string, optional, nullable) — ID of the workspace that owns the created AOP

## Errors

### 400 Bad Request Error

Bad request - invalid AOP configuration or parent folder

- `map from string to any`

### 401 Unauthorized Error

Unauthorized - invalid or missing authentication

- `message` (string, required)

### 404 Not Found Error

Parent folder not found

- `message` (string, required)

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 500 Internal Server Error

The AOP's folder sharing or configuration could not be saved. Nothing was created; retry the request.

- `map from string to any`

## Types

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (ValidationErrorCtx, optional)
- `input` (any, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

**Request**

```json
{
  "agentId": "research_agent",
  "description": "Generates market research reports",
  "icon": "ListTodo",
  "parent_folder_id": "asset_folder_12345",
  "prompt": "Generate a comprehensive market research report for [[ company ]]",
  "section": "Research",
  "title": "Market Research Report",
  "workspace_id": "workspace_abc123"
}
```

**Response**

```json
{
  "asset_id": "string",
  "title": "string",
  "message": "AOP created successfully",
  "parent_folder_id": "string",
  "status": "created",
  "workspace_id": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.athenaintel.com/api/v0/aop/create"

payload = {
    "agentId": "research_agent",
    "description": "Generates market research reports",
    "icon": "ListTodo",
    "parent_folder_id": "asset_folder_12345",
    "prompt": "Generate a comprehensive market research report for [[ company ]]",
    "section": "Research",
    "title": "Market Research Report",
    "workspace_id": "workspace_abc123"
}
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.athenaintel.com/api/v0/aop/create';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"agentId":"research_agent","description":"Generates market research reports","icon":"ListTodo","parent_folder_id":"asset_folder_12345","prompt":"Generate a comprehensive market research report for [[ company ]]","section":"Research","title":"Market Research Report","workspace_id":"workspace_abc123"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.athenaintel.com/api/v0/aop/create"

	payload := strings.NewReader("{\n  \"agentId\": \"research_agent\",\n  \"description\": \"Generates market research reports\",\n  \"icon\": \"ListTodo\",\n  \"parent_folder_id\": \"asset_folder_12345\",\n  \"prompt\": \"Generate a comprehensive market research report for [[ company ]]\",\n  \"section\": \"Research\",\n  \"title\": \"Market Research Report\",\n  \"workspace_id\": \"workspace_abc123\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.athenaintel.com/api/v0/aop/create")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"agentId\": \"research_agent\",\n  \"description\": \"Generates market research reports\",\n  \"icon\": \"ListTodo\",\n  \"parent_folder_id\": \"asset_folder_12345\",\n  \"prompt\": \"Generate a comprehensive market research report for [[ company ]]\",\n  \"section\": \"Research\",\n  \"title\": \"Market Research Report\",\n  \"workspace_id\": \"workspace_abc123\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.athenaintel.com/api/v0/aop/create")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"agentId\": \"research_agent\",\n  \"description\": \"Generates market research reports\",\n  \"icon\": \"ListTodo\",\n  \"parent_folder_id\": \"asset_folder_12345\",\n  \"prompt\": \"Generate a comprehensive market research report for [[ company ]]\",\n  \"section\": \"Research\",\n  \"title\": \"Market Research Report\",\n  \"workspace_id\": \"workspace_abc123\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.athenaintel.com/api/v0/aop/create', [
  'body' => '{
  "agentId": "research_agent",
  "description": "Generates market research reports",
  "icon": "ListTodo",
  "parent_folder_id": "asset_folder_12345",
  "prompt": "Generate a comprehensive market research report for [[ company ]]",
  "section": "Research",
  "title": "Market Research Report",
  "workspace_id": "workspace_abc123"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.athenaintel.com/api/v0/aop/create");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"agentId\": \"research_agent\",\n  \"description\": \"Generates market research reports\",\n  \"icon\": \"ListTodo\",\n  \"parent_folder_id\": \"asset_folder_12345\",\n  \"prompt\": \"Generate a comprehensive market research report for [[ company ]]\",\n  \"section\": \"Research\",\n  \"title\": \"Market Research Report\",\n  \"workspace_id\": \"workspace_abc123\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "agentId": "research_agent",
  "description": "Generates market research reports",
  "icon": "ListTodo",
  "parent_folder_id": "asset_folder_12345",
  "prompt": "Generate a comprehensive market research report for [[ company ]]",
  "section": "Research",
  "title": "Market Research Report",
  "workspace_id": "workspace_abc123"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.athenaintel.com/api/v0/aop/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```