Skip to content
SayGMDocs
Dashboard

Preview guardrail processing

POST
/guard/preview
curl --request POST \
--url https://api.saygm.com/v1/guard/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "scanners": {}, "text": "example" }'

Preview how the supplied scanner configuration processes text. The response reports blocked status, forwarded and returned text, per-scanner counts, and scanners that did not run.

Media typeapplication/json
object
scanners
required
object
key
additional properties
any
text
required
string
key
additional properties
any
Examplegenerated
{
"scanners": {},
"text": "example"
}

The guardrail preview result.

Media typeapplication/json
object
blocked
required
boolean
blocked_by
required
string | null
forwarded_text
required
string | null
returned_text
required
string | null
per_scanner
required
object
key
additional properties
object
detections
required
integer
redacted
required
integer
restored
required
integer
blocked
required
integer
by_entity_type
required
object
key
additional properties
integer
by_entity_type
required
object
key
additional properties
integer
not_run
required
Array<string>
Examplegenerated
{
"blocked": true,
"blocked_by": "example",
"forwarded_text": "example",
"returned_text": "example",
"per_scanner": {
"additionalProperty": {
"detections": 1,
"redacted": 1,
"restored": 1,
"blocked": 1,
"by_entity_type": {
"additionalProperty": 1
}
}
},
"by_entity_type": {
"additionalProperty": 1
},
"not_run": [
"example"
]
}

The request body or preview configuration is invalid.

Media typeapplication/json

OpenAI-shaped gateway error. Image errors after dispatch may also include billing fields at the top level.

object
error
required
object
message
required
string
type
required
string
code
required

Machine-readable error code. Account request limits use rate_limit_exceeded.

string
param
required
string | null
request_id

Gateway request identifier.

string
charged
boolean
billing_status
string
Allowed values: settled unbilled unknown
potentially_charged
boolean
cost_ndollars

Settled charge in nano-dollars; present when billing_status is settled.

integer
Example
{
"billing_status": "settled"
}

The API key is missing or invalid.

Media typeapplication/json

OpenAI-shaped gateway error. Image errors after dispatch may also include billing fields at the top level.

object
error
required
object
message
required
string
type
required
string
code
required

Machine-readable error code. Account request limits use rate_limit_exceeded.

string
param
required
string | null
request_id

Gateway request identifier.

string
charged
boolean
billing_status
string
Allowed values: settled unbilled unknown
potentially_charged
boolean
cost_ndollars

Settled charge in nano-dollars; present when billing_status is settled.

integer
Example
{
"billing_status": "settled"
}

The request body could not be read before the deadline.

Media typeapplication/json

OpenAI-shaped gateway error. Image errors after dispatch may also include billing fields at the top level.

object
error
required
object
message
required
string
type
required
string
code
required

Machine-readable error code. Account request limits use rate_limit_exceeded.

string
param
required
string | null
request_id

Gateway request identifier.

string
charged
boolean
billing_status
string
Allowed values: settled unbilled unknown
potentially_charged
boolean
cost_ndollars

Settled charge in nano-dollars; present when billing_status is settled.

integer
Example
{
"billing_status": "settled"
}

The request body is too large.

Media typeapplication/json

OpenAI-shaped gateway error. Image errors after dispatch may also include billing fields at the top level.

object
error
required
object
message
required
string
type
required
string
code
required

Machine-readable error code. Account request limits use rate_limit_exceeded.

string
param
required
string | null
request_id

Gateway request identifier.

string
charged
boolean
billing_status
string
Allowed values: settled unbilled unknown
potentially_charged
boolean
cost_ndollars

Settled charge in nano-dollars; present when billing_status is settled.

integer
Example
{
"billing_status": "settled"
}

The account has reached the request rate limit. Retry after the supplied delay.

Media typeapplication/json

OpenAI-shaped gateway error. Image errors after dispatch may also include billing fields at the top level.

object
error
required
object
message
required
string
type
required
string
code
required

Machine-readable error code. Account request limits use rate_limit_exceeded.

string
param
required
string | null
request_id

Gateway request identifier.

string
charged
boolean
billing_status
string
Allowed values: settled unbilled unknown
potentially_charged
boolean
cost_ndollars

Settled charge in nano-dollars; present when billing_status is settled.

integer
Example
{
"billing_status": "settled"
}
Retry-After
integer
>= 1

Seconds to wait before retrying.

The preview could not be completed.

Media typeapplication/json

OpenAI-shaped gateway error. Image errors after dispatch may also include billing fields at the top level.

object
error
required
object
message
required
string
type
required
string
code
required

Machine-readable error code. Account request limits use rate_limit_exceeded.

string
param
required
string | null
request_id

Gateway request identifier.

string
charged
boolean
billing_status
string
Allowed values: settled unbilled unknown
potentially_charged
boolean
cost_ndollars

Settled charge in nano-dollars; present when billing_status is settled.

integer
Example
{
"billing_status": "settled"
}

The service cannot complete the request right now.

Media typeapplication/json

OpenAI-shaped gateway error. Image errors after dispatch may also include billing fields at the top level.

object
error
required
object
message
required
string
type
required
string
code
required

Machine-readable error code. Account request limits use rate_limit_exceeded.

string
param
required
string | null
request_id

Gateway request identifier.

string
charged
boolean
billing_status
string
Allowed values: settled unbilled unknown
potentially_charged
boolean
cost_ndollars

Settled charge in nano-dollars; present when billing_status is settled.

integer
Example
{
"billing_status": "settled"
}