POST /classifications/v1

Classify text for sensitive data patterns (PII, credentials, phone numbers, addresses, etc.). Returns match positions, confidence scores, and classifier identifiers.

Endpoint

POST /classifications/v1

Authentication

Requires Authorization: Bearer <token> header. Returns 401 Unauthorized with a WWW-Authenticate header if the token is missing or invalid.

Request Body

{
  "context": {
    "actor": "user",
    "agent_id": "my-agent",
    "platform": "AMAZON_BEDROCK"
  },
  "classifierDescription": {
    "type": "profile",
    "uuid": "7dbf380f-0af8-4276-acb0-85413db2dbff",
    "version": 1
  },
  "structured": false,
  "metadata": {
    "objectName": "object",
    "parentObjectName": "parent",
    "xPath": "path",
    "fileExtension": "extension"
  },
  "text": "phone 321-507-0525 number"
}

Request Fields

FieldTypeRequiredDescription
contextobjectYesContext metadata passed through to metrics
context.actorstringYes"user" or "agent" β€” identifies the source of the text
context.agent_idstringYesUnique identifier for the calling agent
context.platformstringYesAI platform: AMAZON_BEDROCK, AMAZON_SAGEMAKER, AZURE_FOUNDRY, DATABRICKS, or GCP_VERTEX
classifierDescriptionobjectYesSpecifies which classifiers to use (see below)
structuredbooleanYesWhether the text is structured data
metadataobjectNoOptional metadata about the content source
textstringYesThe text to classify

Classifier Description Types

Profile-Based

{
  "type": "profile",
  "uuid": "7dbf380f-0af8-4276-acb0-85413db2dbff",
  "version": 1
}
FieldTypeRequiredDescription
typestringYes"profile"
uuidstring (UUID)YesClassification profile UUID
versionintegerYesProfile version number

Code-Based

{
  "type": "codes",
  "codes": [
    { "code": "C1", "version": 1 },
    { "code": "C2", "version": 2 }
  ]
}
FieldTypeRequiredDescription
typestringYes"codes"
codesarrayYesList of classifier code objects
codes[].codestringYesClassifier code
codes[].versionintegerYesClassifier version

JSON-Based

{
  "type": "json",
  "classifiers": [
    { "name": "A" },
    { "name": "B" }
  ]
}
FieldTypeRequiredDescription
typestringYes"json"
classifiersarrayYesInline classifier definition objects

Metadata Fields

FieldTypeDescription
objectNamestringName of the content object
parentObjectNamestringName of the parent object
xPathstringXPath to the content
fileExtensionstringFile extension of the source

Response

200 OK β€” Successful Classification

{
  "context": {
    "actor": "user",
    "agent_id": "my-agent",
    "platform": "AMAZON_BEDROCK"
  },
  "matches": [
    {
      "start": 6,
      "end": 18,
      "confidence": 100,
      "text": "321-507-0525",
      "classifier": "US_PHONE_NUMBER"
    }
  ]
}

Response Fields

FieldTypeDescription
contextobjectThe context from the request, passed through
matchesarrayList of classification matches (empty if no sensitive data detected)
matches[].startintegerStarting character position of the match
matches[].endintegerEnding character position of the match
matches[].confidenceintegerConfidence score (0–100)
matches[].textstringThe matched text content
matches[].classifierstringName of the classifier that matched

Error Responses

400 Bad Request

{
  "code": 400,
  "message": "Invalid classifier description"
}

401 Unauthorized

{
  "code": 401,
  "message": "Invalid or missing bearer token"
}

Includes a WWW-Authenticate header.

500 Internal Server Error

{
  "code": 500,
  "message": "Classification engine error"
}

502 Bad Gateway

{
  "code": 502,
  "message": "Upstream classification service unavailable"
}

curl Example

curl -X POST https://localhost:4443/classifications/v1 \
  --pinnedpubkey "sha256//x48Lk2iu3R3nAhSiz07bExGHTusDRjHqBx9ArK3cFGE=" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{
    "context": { "actor": "user", "agent_id": "my-agent", "platform": "AMAZON_BEDROCK" },
    "classifierDescription": {
      "type": "profile",
      "uuid": "7dbf380f-0af8-4276-acb0-85413db2dbff",
      "version": 1
    },
    "structured": false,
    "metadata": {
      "objectName": "object",
      "parentObjectName": "parent",
      "xPath": "path",
      "fileExtension": "extension"
    },
    "text": "phone 321-507-0525 number"
  }'

SDK Usage

For Python SDK usage, see Classify Text.