---
title: Create Prompt
description: Reference for the POST /console/v1/prompts API endpoint.
product: general
token_estimate: 1897
---
# Create Prompt

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## Create Prompt

**POST** `/console/v1/prompts`

Full URL: `https://statsigapi.net/console/v1/prompts`

Create Prompt

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| STATSIG-API-KEY | string | Yes | — | apiKey (header) |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name | string | Yes | my_prompt | Name for the AI Config. Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-. ]*$ |
| displayName | string | No | — | Optional display name for the AI Config. Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-. ]*$ |
| description | string | No | — | Description for the AI Config. Constraints: max length: 1000 |
| targetApps | oneOf | No | — | List of target app names. Constraints: string, string[] |
| team | string | No | — | Team name. |
| teamID | string | No | — | Team ID. |
| tags | string[] | No | — | Optional tags to associate with the AI Config. |
| creatorID | string | No | — | Constraints: nullable |
| owner | object | No | {"ownerID":"user123","ownerType":"USER","ownerName":"John Doe","ownerEmail":"owner123@test.com"} | Schema for owner data including ID, type, name. Constraints: nullable |
| owner.ownerID | string | No | abc123 | ID of the owner |
| owner.ownerType | string | No | USER | Type of the owner (e.g., SDK_KEY or USER) |
| owner.ownerName | string | No | John Doe | The name of the owner. This field is optional. |
| owner.ownerEmail | string | No | — | The email of the owner. This field is optional. |
| creatorEmail | string | No | — | Constraints: nullable |

## Response (application/json)

**200** — Create Prompt

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | string | Yes | — | A simple string explaining the result of the operation. |
| data | object | Yes | — | — |
| data.id | string | Yes | — | ID |
| data.name | string | No | — | The gate display name Constraints: min length: 3, max length: 100, pattern: ^[a-zA-Z0-9_\-. ]*$ |
| data.idType | string | No | — | — |
| data.description | string | Yes | — | Constraints: max length: 1000 |
| data.lastModifierID | string | Yes | — | ID of the last modifier. Constraints: nullable |
| data.lastModifiedTime | number | Yes | — | Time of the last modification. Constraints: format: double, nullable |
| data.lastModifierEmail | string | Yes | — | Email of the last modifier. Constraints: nullable |
| data.lastModifierName | string | Yes | — | Name of the last modifier. Constraints: nullable |
| data.creatorID | string | No | — | Constraints: nullable |
| data.createdTime | number | Yes | — | Timestamp when the entity was created. Constraints: format: double |
| data.creatorName | string | Yes | — | Name of the creator. Constraints: nullable |
| data.creatorEmail | string | No | — | Constraints: nullable |
| data.tags | string[] | No | — | — |
| data.targetApps | string[] | No | — | List of target applications associated with this configuration. |
| data.holdoutIDs | string[] | No | — | Holdouts applied to this configuration. |
| data.team | string | No | — | Constraints: nullable |
| data.teamID | string | No | — | Constraints: nullable |
| data.version | number | No | — | Version number Constraints: format: double |

```json
{
  "message": "string",
  "data": {
    "id": "string",
    "name": "string",
    "idType": "string",
    "description": "string",
    "lastModifierID": "string",
    "lastModifiedTime": 0,
    "lastModifierEmail": "string",
    "lastModifierName": "string",
    "creatorID": "string",
    "createdTime": 0,
    "creatorName": "string",
    "creatorEmail": "string",
    "tags": [
      "string"
    ],
    "targetApps": [
      "string"
    ],
    "holdoutIDs": [
      "string"
    ],
    "team": "string",
    "teamID": "string",
    "version": 0
  }
}
```

**400** — Invalid request. Please check the request input and try again.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 400 |
| message | string | Yes | — | — |

```json
{
  "status": 400,
  "message": "Invalid request. Please check the request input and try again."
}
```

**401** — This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 401 |
| message | string | Yes | — | — |

```json
{
  "status": 401,
  "message": "This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx"
}
```

**403** — Forbidden. The request was valid, but the server is refusing action. You might not have the necessary permissions to access the resource.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 403 |
| message | string | Yes | — | — |

```json
{
  "status": 403,
  "message": "Forbidden. The request was valid, but the server is refusing action. You might not have the necessary permissions to access the resource."
}
```

## Code samples

### cURL

```bash
curl -X POST "https://statsigapi.net/console/v1/prompts" \
  -H "Content-Type: application/json" \
  -H "STATSIG-API-KEY: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.post(
    "https://statsigapi.net/console/v1/prompts",
    headers={
        "Content-Type": "application/json",
        "STATSIG-API-KEY": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://statsigapi.net/console/v1/prompts", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "STATSIG-API-KEY": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://statsigapi.net/console/v1/prompts");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "STATSIG-API-KEY: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
req, _ := http.NewRequest("POST", "https://statsigapi.net/console/v1/prompts", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("STATSIG-API-KEY", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://statsigapi.net/console/v1/prompts"))
      .method("POST", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("STATSIG-API-KEY", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://statsigapi.net/console/v1/prompts")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["STATSIG-API-KEY"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

