Share via


Content Classifiers - Create Or Replace

Create a new classifier asynchronously.

PUT {endpoint}/contentunderstanding/classifiers/{classifierId}?api-version=2025-05-01-preview

URI Parameters

Name In Required Type Description
classifierId
path True

string

pattern: ^[a-zA-Z0-9._-]{1,64}$

The unique identifier of the classifier.

endpoint
path True

string (uri)

Content Understanding service endpoint.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Header

Name Required Type Description
x-ms-client-request-id

string (uuid)

An opaque, globally-unique, client-generated string identifier for the request.

Request Body

Name Required Type Description
categories True

<string,  ClassifierCategory>

The categories to classify against.

description

string

A description of the classifier.

processingLocation

ProcessingLocation

The location where the data may be processed.

splitMode

ClassifierSplitMode

Mode used to split input into content objects.

tags

object

Tags associated with the classifier.

Responses

Name Type Description
200 OK

ContentClassifier

The request has succeeded.

Headers

  • Operation-Location: string
  • x-ms-client-request-id: string
201 Created

ContentClassifier

The request has succeeded and a new resource has been created as a result.

Headers

  • Operation-Location: string
  • x-ms-client-request-id: string
Other Status Codes

Azure.Core.Foundations.ErrorResponse

An unexpected error response.

Headers

x-ms-error-code: string

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

OAuth2Auth

Type: oauth2
Flow: accessCode
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize
Token URL: https://login.microsoftonline.com/common/oauth2/token

Scopes

Name Description
https://cognitiveservices.azure.com/.default

Examples

Create or Replace Classifier

Sample request

PUT {endpoint}/contentunderstanding/classifiers/myClassifier?api-version=2025-05-01-preview

{
  "description": "My classifier",
  "tags": {
    "createdBy": "John"
  },
  "splitMode": "auto",
  "categories": {
    "receipt": {
      "description": "Sales receipts"
    },
    "invoice": {
      "analyzerId": "myInvoice"
    }
  }
}

Sample response

Operation-Location: https://myendpoint.cognitiveservices.azure.com/contentunderstanding/classifiers/myClassifier/operations/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2025-05-01-preview
{
  "classifierId": "myClassifier",
  "description": "My classifier",
  "tags": {
    "createdBy": "John"
  },
  "status": "creating",
  "createdAt": "2025-05-01T18:46:36.051Z",
  "lastModifiedAt": "2025-05-01T18:46:36.051Z",
  "splitMode": "auto",
  "categories": {
    "receipt": {
      "description": "Sales receipts"
    },
    "invoice": {
      "analyzerId": "myInvoice"
    }
  }
}
Operation-Location: https://myendpoint.cognitiveservices.azure.com/contentunderstanding/classifiers/myClassifier/operations/3b31320d-8bab-4f88-b19c-2322a7f11034?api-version=2025-05-01-preview
{
  "classifierId": "myClassifier",
  "description": "My classifier",
  "tags": {
    "createdBy": "John"
  },
  "status": "creating",
  "createdAt": "2025-05-01T18:46:36.051Z",
  "lastModifiedAt": "2025-05-01T18:46:36.051Z",
  "splitMode": "auto",
  "categories": {
    "receipt": {
      "description": "Sales receipts"
    },
    "invoice": {
      "analyzerId": "myInvoice"
    }
  }
}

Definitions

Name Description
Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Azure REST API guidelines - https://aka.ms/AzureRestApiGuidelines#handling-errors.

ClassifierCategory

A classifier category.

ClassifierSplitMode

Mode used to split input into content objects.

ContentClassifier

Classifier that classifies content into categories with optional splitting.

ProcessingLocation

The location where the data may be processed.

ResourceStatus

Status of a resource.

Azure.Core.Foundations.Error

The error object.

Name Type Description
code

string

One of a server-defined set of error codes.

details

Azure.Core.Foundations.Error[]

An array of details about specific errors that led to this reported error.

innererror

Azure.Core.Foundations.InnerError

An object containing more specific information than the current object about the error.

message

string

A human-readable representation of the error.

target

string

The target of the error.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Name Type Description
error

Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Azure REST API guidelines - https://aka.ms/AzureRestApiGuidelines#handling-errors.

Name Type Description
code

string

One of a server-defined set of error codes.

innererror

Azure.Core.Foundations.InnerError

Inner error.

ClassifierCategory

A classifier category.

Name Type Description
analyzerId

string

Optional analyzer used to process the content.

description

string

The description of the category.

ClassifierSplitMode

Mode used to split input into content objects.

Value Description
noSplit

Treat the entire input as a single content object.

perPage

Split each page of the input into a separate content object.

auto

Split the input into content objects based on the input and category definitions.

ContentClassifier

Classifier that classifies content into categories with optional splitting.

Name Type Default value Description
categories

<string,  ClassifierCategory>

The categories to classify against.

classifierId

string

pattern: ^[a-zA-Z0-9._-]{1,64}$

The unique identifier of the classifier.

createdAt

string (date-time)

The date and time when the classifier was created.

description

string

A description of the classifier.

lastModifiedAt

string (date-time)

The date and time when the classifier was last modified.

processingLocation

ProcessingLocation

geography

The location where the data may be processed.

splitMode

ClassifierSplitMode

noSplit

Mode used to split input into content objects.

status

ResourceStatus

The status of the classifier.

tags

object

Tags associated with the classifier.

warnings

Azure.Core.Foundations.Error[]

Warnings encountered while creating the classifier.

ProcessingLocation

The location where the data may be processed.

Value Description
geography

Data may be processed in the same geography as the resource.

dataZone

Data may be processed in the same data zone as the resource.

global

Data may be processed in any Azure data center globally.

ResourceStatus

Status of a resource.

Value Description
creating

The resource is being created.

ready

The resource is ready.

deleting

The resource is being deleted.

failed

The resource failed during creation.