Skip to Content

Update a custom behavior

PATCHhttps://api.respan.ai/api/pulses/behaviors/custom/{id}/

Changes a custom behavior’s name, definition or polarity. A new definition reaches new spans within about a minute; past spans are not rescored.

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

Path parameters

Parameter Type Required Description and constraints
id string Required
Custom behavior ID.
Example: "6f1c2a9e-3b7d-4c55-9a0e-2d8f4b1c7e93"

Request body

A request body is required.

application/json

Field Type Requirement Description and constraints
$ object Required body
Send only the fields to change.
Reference: #/components/schemas/CustomBehaviorUpdateRequest
description string Optional
New definition. New spans are scored against it within about a minute. Past spans are not rescored.
Minimum length: 3
Example: "The assistant promises a refund, credit, or compensation that the policy in the system prompt does not allow."
name string or null Optional
New display name. Blank or null clears it.
Maximum length: 128
Example: "Refund promise"
polarity string Optional
Whether the behavior firing is good or bad: negative (an Issue), positive (a Win) or neutral (Info). Display metadata only; it does not change how spans are scored.
polarity (allOf 1) string Schema variant
Whether the behavior firing is good or bad: negative (an Issue), positive (a Win) or neutral (Info). Display metadata only; it does not change how spans are scored.
Reference: #/components/schemas/BehaviorPolarity
Allowed: "negative", "positive", "neutral"
Example: "negative"

OpenAPI request schema

{
  "$ref": "#/components/schemas/CustomBehaviorUpdateRequest"
}
Example
JSON
{ "polarity": "negative" }

Responses

200

The updated behavior, without tags.

application/json

Field Type Requirement Description and constraints
$ object Body
Reference: #/components/schemas/CustomBehavior
id string Required in parent
Custom behavior ID. It is also the behavior’s key in analytics, filters and span verdicts.
Example: "6f1c2a9e-3b7d-4c55-9a0e-2d8f4b1c7e93"
name string or null Required in parent
Display name. Optional and not unique; behaviors are identified by id.
Maximum length: 128
Example: "Refund promise"
description string Required in parent
The plain-language definition span-01 scores each span against. Say what counts and what doesn’t. At least 3 characters after trimming.
Example: "The assistant promises a refund, credit, or compensation that the policy in the system prompt does not allow."
polarity string Required in parent
Whether the behavior firing is good or bad: negative (an Issue), positive (a Win) or neutral (Info). Display metadata only; it does not change how spans are scored.
Reference: #/components/schemas/BehaviorPolarity
Allowed: "negative", "positive", "neutral"
Example: "negative"
created_at string Required in parent
Format: date-time
Example: "2026-09-28T17:41:09.512340Z"
updated_at string Required in parent
Format: date-time
Example: "2026-09-28T17:41:09.512340Z"

OpenAPI response schema

{
  "$ref": "#/components/schemas/CustomBehavior"
}
Example
JSON
{ "id": "6f1c2a9e-3b7d-4c55-9a0e-2d8f4b1c7e93", "name": "Refund promise", "description": "The assistant promises a refund, credit, or compensation that the policy in the system prompt does not allow.", "polarity": "negative", "created_at": "2026-09-28T17:41:09.512340Z", "updated_at": "2026-09-28T17:41:09.512340Z" }

400

Validation failed. The body maps each invalid field to its errors.

application/json

Field Type Requirement Description and constraints
$ object Body
-
$.<key> array<string> Map value
-
$.<key>[] string Array item
-

OpenAPI response schema

{
  "type": "object",
  "additionalProperties": {
    "type": "array",
    "items": {
      "type": "string"
    }
  }
}
Example
JSON
{ "description": [ "Ensure this field has at least 3 characters." ] }

403

Forbidden: the API key is missing, invalid or expired; the key doesn’t grant custom_behaviors:update (Write access does); behaviors are turned off for the organization.

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"
    }
  }
}
Missing or invalid API key
JSON
{ "detail": "Your API key is invalid or expired, please check your API key in the platform settings." }
Key lacks the permission
JSON
{ "detail": "This API key does not have the 'custom_behaviors:update' permission." }
Behaviors are off for the organization
JSON
{ "detail": "Span Behaviors is not enabled for this organization." }

404

No custom behavior with this ID in your organization.

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": "No CustomBehavior matches the given query." }

429

Rate limited. This endpoint allows 30 requests per minute per organization.

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": "Request was throttled." }

OpenAPI source

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

OpenAPI operation

{
  "summary": "Update a custom behavior",
  "operationId": "updateCustomBehavior",
  "tags": [
    "Behaviors"
  ],
  "description": "Changes a custom behavior's name, definition or polarity. A new definition reaches new spans within about a minute; past spans are not rescored.",
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Custom behavior ID.",
      "example": "6f1c2a9e-3b7d-4c55-9a0e-2d8f4b1c7e93"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CustomBehaviorUpdateRequest"
        },
        "example": {
          "polarity": "negative"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "The updated behavior, without tags.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CustomBehavior"
          },
          "example": {
            "id": "6f1c2a9e-3b7d-4c55-9a0e-2d8f4b1c7e93",
            "name": "Refund promise",
            "description": "The assistant promises a refund, credit, or compensation that the policy in the system prompt does not allow.",
            "polarity": "negative",
            "created_at": "2026-09-28T17:41:09.512340Z",
            "updated_at": "2026-09-28T17:41:09.512340Z"
          }
        }
      }
    },
    "400": {
      "description": "Validation failed. The body maps each invalid field to its errors.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "example": {
            "description": [
              "Ensure this field has at least 3 characters."
            ]
          }
        }
      }
    },
    "403": {
      "description": "Forbidden: the API key is missing, invalid or expired; the key doesn't grant `custom_behaviors:update` (Write access does); behaviors are turned off for the organization.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "examples": {
            "invalidKey": {
              "summary": "Missing or invalid API key",
              "value": {
                "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
              }
            },
            "missingPermission": {
              "summary": "Key lacks the permission",
              "value": {
                "detail": "This API key does not have the 'custom_behaviors:update' permission."
              }
            },
            "behaviorsOff": {
              "summary": "Behaviors are off for the organization",
              "value": {
                "detail": "Span Behaviors is not enabled for this organization."
              }
            }
          }
        }
      }
    },
    "404": {
      "description": "No custom behavior with this ID in your organization.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "No CustomBehavior matches the given query."
          }
        }
      }
    },
    "429": {
      "description": "Rate limited. This endpoint allows 30 requests per minute per organization.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Request was throttled."
          }
        }
      }
    }
  },
  "security": [
    {
      "RespanApiKey": []
    }
  ]
}

OpenAPI path metadata

{}

Referenced OpenAPI components

{
  "schemas": {
    "BehaviorPolarity": {
      "type": "string",
      "enum": [
        "negative",
        "positive",
        "neutral"
      ],
      "description": "Whether the behavior firing is good or bad: `negative` (an Issue), `positive` (a Win) or `neutral` (Info). Display metadata only; it does not change how spans are scored.",
      "example": "negative"
    },
    "CustomBehavior": {
      "type": "object",
      "required": [
        "id",
        "name",
        "description",
        "polarity",
        "created_at",
        "updated_at"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Custom behavior ID. It is also the behavior's key in analytics, filters and span verdicts.",
          "example": "6f1c2a9e-3b7d-4c55-9a0e-2d8f4b1c7e93"
        },
        "name": {
          "type": "string",
          "nullable": true,
          "maxLength": 128,
          "description": "Display name. Optional and not unique; behaviors are identified by `id`.",
          "example": "Refund promise"
        },
        "description": {
          "type": "string",
          "description": "The plain-language definition span-01 scores each span against. Say what counts and what doesn't. At least 3 characters after trimming.",
          "example": "The assistant promises a refund, credit, or compensation that the policy in the system prompt does not allow."
        },
        "polarity": {
          "$ref": "#/components/schemas/BehaviorPolarity"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "example": "2026-09-28T17:41:09.512340Z"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "example": "2026-09-28T17:41:09.512340Z"
        }
      }
    },
    "CustomBehaviorUpdateRequest": {
      "type": "object",
      "description": "Send only the fields to change.",
      "properties": {
        "description": {
          "type": "string",
          "minLength": 3,
          "description": "New definition. New spans are scored against it within about a minute. Past spans are not rescored.",
          "example": "The assistant promises a refund, credit, or compensation that the policy in the system prompt does not allow."
        },
        "name": {
          "type": "string",
          "nullable": true,
          "maxLength": 128,
          "description": "New display name. Blank or `null` clears it.",
          "example": "Refund promise"
        },
        "polarity": {
          "allOf": [
            {
              "$ref": "#/components/schemas/BehaviorPolarity"
            }
          ],
          "description": "Whether the behavior firing is good or bad: `negative` (an Issue), `positive` (a Win) or `neutral` (Info). Display metadata only; it does not change how spans are scored."
        }
      }
    }
  },
  "securitySchemes": {
    "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"
      }
    }
  }
}