Common HTTP request and response headers (Azure AI Search)

The Azure AI Search REST APIs support a set of common HTTP request/response headers, summarized here for reference:

Request Header Type Description
Accept Content type The requested content type for the response. Default is application/json;odata.metadata=minimal. Other allowable values are application/json, application/json;odata.metadata=full, application/json;odata.metadata=none, and text/plain (for $count only).
api-key String Set to your query or admin key, depending on the API.
authorization String The OAuth 2.0 access token for the request. Requires configuration to your search service for role-based access. This request header is for client apps that use Microsoft Entra ID authentication and role assignments. Your client code must provide the token. You can use this request header with any supported REST API version as long as the search service is configured for data plane authentication.
Content-Type Content-Type Content type of request body (PUT/POST). Default is application/json.
client-request-id GUID Optional caller-specified request ID, in the form of a GUID with no decoration such as curly braces (for example, client-request-id: 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0). A caller-defined value that identifies the given request. If specified, this value is included in response information as a way to map the request.
OData-MaxVersion "4.0" Specifies the maximum version of the OData protocol supported by the client. Default is "4.0"
Prefer "return=representation" or "return=minimal" Used to control the response payload from PUT and POST /indexes requests. Default is "return=representation" when creating a new index via POST or PUT, and "return=minimal" for updating an existing index via PUT.
return-client-request-id True or False If specified when client-request-id is specified, instructs the server to include the client-request-id header in the response. Default is False.
If-Match ETag or * Used to change a resource only if the current version matches the specified ETag. Use this header with POST, PUT, or DELETE methods on resources (such as indexers, indexes, and data sources, but not documents) to enable optimistic concurrency control.
If-None-Match ETag or * Used to change a resource only if the current version doesn't match the specified ETag. Use this header with POST, PUT, or DELETE methods on resources (such as indexers, indexes, and data sources, but not documents) to enable optimistic concurrency control.
Response Header Type Description
client-request-id GUID An identifier specified by the caller in the original request, if present.
Content-Type Content-Type The content type of the response body.
Location URL The URL of the newly created index definition for POST and PUT /indexes requests.
OData-Version "4.0" OData protocol version of the response.
request-id GUID A unique identifier for the current operation. Equal to client-request-id if specified; otherwise the value is generated on the server.
elapsed-time Number Time, in milliseconds, that the service spent processing the request. This value only includes the time spent on processing the request, and doesn't include network transfer time.
ETag String An opaque string representing the current version of a resource (returned for indexers, indexes, and data sources, but not documents). Use this string in the If-Match or If-None-Match header for optimistic concurrency control.

See also

Azure AI Search REST APIs