Skip to Content

Create a response format preset

POSThttps://api.respan.ai/api/response-format-presets/

Stores JSON-schema text in the caller’s project as a JSON string, validated without reformatting. The server sets the project and creator.

Servers

https://api.respan.ai: Respan API Server

Authentication

RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: bearer; format: Respan API key.

HTTP
Authorization: Bearer $RESPAN_API_KEY

Or:

DashboardJwt

Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

HTTP scheme: bearer; format: Dashboard JWT.

HTTP
Authorization: Bearer $RESPAN_DASHBOARD_JWT

Request body

A request body is required.

application/json

Field Type Requirement Description and constraints
$ object Required body
-
name string Required in parent
Minimum length: 1
response_format_content string Required in parent
JSON text preserved verbatim. It must decode to an object with a non-empty name and an object-valued schema.
is_enforcing_response_format boolean Optional
Default: false

OpenAPI request schema

{
  "type": "object",
  "required": [
    "name",
    "response_format_content"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "response_format_content": {
      "type": "string",
      "description": "JSON text preserved verbatim. It must decode to an object with a non-empty `name` and an object-valued `schema`."
    },
    "is_enforcing_response_format": {
      "type": "boolean",
      "default": false
    }
  }
}

Responses

201

Preset created.

application/json

Field Type Requirement Description and constraints
$ object Body
-
id string Required in parent
-
name string Required in parent
-
project string Required in parent
Server-stamped project UUID.
created_by integer or null Required in parent
Server-stamped creator user ID.
response_format_content string Required in parent
JSON text preserved verbatim. It must decode to an object with a non-empty name and an object-valued schema.
is_enforcing_response_format boolean Required in parent
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "id",
    "name",
    "project",
    "created_by",
    "response_format_content",
    "is_enforcing_response_format"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "project": {
      "type": "string",
      "description": "Server-stamped project UUID."
    },
    "created_by": {
      "type": "integer",
      "nullable": true,
      "description": "Server-stamped creator user ID."
    },
    "response_format_content": {
      "type": "string",
      "description": "JSON text preserved verbatim. It must decode to an object with a non-empty `name` and an object-valued `schema`."
    },
    "is_enforcing_response_format": {
      "type": "boolean"
    }
  }
}

400

Invalid preset content.

application/json

Field Type Requirement Description and constraints
$ object Body
Additional properties are allowed

OpenAPI response schema

{
  "type": "object",
  "additionalProperties": true
}

403

The API key is missing, invalid or expired.

application/json

Field Type Requirement Description and constraints
$ object Body
-
detail string Required in parent
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
Example
JSON
{ "detail": "Your API key is invalid or expired, please check your API key in the platform settings." }

OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

OpenAPI operation

{
  "summary": "Create a response format preset",
  "operationId": "api_response_format_presets_create",
  "tags": [
    "Prompts"
  ],
  "description": "Stores JSON-schema text in the caller's project as a JSON string, validated without reformatting. The server sets the project and creator.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "name",
            "response_format_content"
          ],
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1
            },
            "response_format_content": {
              "type": "string",
              "description": "JSON text preserved verbatim. It must decode to an object with a non-empty `name` and an object-valued `schema`."
            },
            "is_enforcing_response_format": {
              "type": "boolean",
              "default": false
            }
          }
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Preset created.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "id",
              "name",
              "project",
              "created_by",
              "response_format_content",
              "is_enforcing_response_format"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "project": {
                "type": "string",
                "description": "Server-stamped project UUID."
              },
              "created_by": {
                "type": "integer",
                "nullable": true,
                "description": "Server-stamped creator user ID."
              },
              "response_format_content": {
                "type": "string",
                "description": "JSON text preserved verbatim. It must decode to an object with a non-empty `name` and an object-valued `schema`."
              },
              "is_enforcing_response_format": {
                "type": "boolean"
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Invalid preset content.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    }
  },
  "security": [
    {
      "RespanApiKey": []
    },
    {
      "DashboardJwt": []
    }
  ]
}

OpenAPI path metadata

{}

Referenced OpenAPI components

{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "DashboardJwt": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Dashboard JWT",
      "description": "Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.",
      "x-fern-bearer": {
        "name": "dashboardJwt",
        "env": "RESPAN_DASHBOARD_JWT"
      }
    },
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}