Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Get project safety alert

safety.alerts.retrieve(strid) -> SafetyAlert
GET/safety/alerts/{id}

Get a safety alert belonging to the authenticated API project.

ParametersExpand Collapse
id: str

Project safety alert ID

maxLength38
ReturnsExpand Collapse
class SafetyAlert: …
id: str
created_at: int
formatunixtime
error_type: Literal["potentially_unintended_data_transfer", "potentially_unintended_data_access", "potentially_unintended_destructive_activity", "other"]
model: str
object: Literal["safety.alert"]
reason: Optional[str]

A customer-safe description derived from error_type, or null for zero data retention requests.

request_id: str
request_paused: bool

Whether block registration succeeded for this request. This does not confirm that response execution stopped.

response_id: str

Get project safety alert

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
safety_alert = client.safety.alerts.retrieve(
    "id",
)
print(safety_alert.id)
{
  "id": "alert_0123456789abcdef0123456789abcdef",
  "object": "safety.alert",
  "created_at": 1787659200,
  "request_id": "req_123",
  "response_id": "resp_123",
  "model": "gpt-6-astra",
  "request_paused": true,
  "error_type": "potentially_unintended_data_access",
  "reason": "Potentially unintended data access."
}
Returns Examples
{
  "id": "alert_0123456789abcdef0123456789abcdef",
  "object": "safety.alert",
  "created_at": 1787659200,
  "request_id": "req_123",
  "response_id": "resp_123",
  "model": "gpt-6-astra",
  "request_paused": true,
  "error_type": "potentially_unintended_data_access",
  "reason": "Potentially unintended data access."
}