For the complete documentation index, see llms.txt. This page is also available as Markdown.

Replace complete

Beta. Catalog replace is a Beta feature and its API surface may change before GA. You must send the Batch-Beta: catalog-replace header with each replace call.

Use /catalogs/replace/complete to apply the pending revision in one atomic operation. When the call is successful, the catalog serves the new revision. Batch removes the previous contents. Readers see the full old catalog, then the full new catalog. They never see a state between the two.

Beta

Replace Complete

post

Beta. Catalog replace is a Beta feature and can change. Send the Batch-Beta: catalog-replace header on each call. Applies the pending revision in one atomic operation. When this call is successful, the catalog serves the new revision and Batch removes the previous contents. Readers see the complete old catalog, then the complete new catalog. They never see a state between the two. Batch must index every item in the pending revision before you can apply it. If indexing is not complete, the call returns 409 CATALOG_REPLACE_NOT_READY. Retry the call after a short delay. To follow the progress, read the pending_replace block of /catalogs/view.

Authorizations
AuthorizationstringRequired

API Key Authentication

Authentication is required in order to interact with Batch's APIs.

Batch implements authentication using API Keys, that we call the "REST API Key". You can find it on your dashboard.

Please make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would easily be extractable.

How to authenticate

In order to authenticate your requests, add your REST API Key in the Authorization header and prefix it by Bearer. Example: Authorization: Bearer bcd38d9rfb38ra28.

Header parameters
X-Batch-ProjectstringRequired

The unique project key, identifying a project on the Batch platform

Example: project_0664hxvwffvbpn278gxdyhsadddqgna6
Batch-BetastringRequired

Value of the Batch-Beta header. It is a comma-separated list of Beta contract flags. Thus one request can opt into more than one Beta contract at the same time (first-flag, second-flag). Flags are lowercase and case-sensitive, and the order does not matter. Batch rejects an unknown flag with a 400 on any endpoint. When a contract becomes generally available, Batch continues to accept its flag but the flag has no more effect. Thus you never need to remove it.

Example: catalog-replace
Body
replace_tokenstringRequired

Token that /catalogs/replace/start returns.

Example: eqRqTF7xFznYoG0MLs1sIqM1JhmhGLTZ7I5NtM5f
Responses
200

Empty success response

application/json
object · EmptyResponseOptional
post/catalogs/replace/complete
POST /2.12/catalogs/replace/complete HTTP/1.1
Host: api.batch.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-Batch-Project: text
Batch-Beta: text
Content-Type: application/json
Accept: */*
Content-Length: 60

{
  "replace_token": "eqRqTF7xFznYoG0MLs1sIqM1JhmhGLTZ7I5NtM5f"
}
{}

Request structure

Route

The Catalog API has a POST endpoint that applies the pending revision of a replace session:

/catalogs/replace/complete

Batch must index each item in the pending revision before you apply it. To see the progress, read the pending_replace block of /catalogs/view. Its indexing_state must be APPLIED.

Headers and authentication

See Overview → Using Project APIs. This endpoint also needs the Batch-Beta: catalog-replace header.

Post data

The body of the request must contain a valid JSON payload. The payload gives the replace_token from /catalogs/replace/start.

Responses

Success

If the call is successful, you receive an HTTP 200 confirmation with an empty body. The catalog now serves the new revision.

Failure

You receive an HTTP 409 in these cases:

  • CATALOG_REPLACE_UNKNOWN: the replace_token is unknown, or its session is complete or cancelled.

  • CATALOG_REPLACE_NOT_READY: the pending revision is still in indexing. Wait a short time and try again.

  • CATALOG_REPLACE_INCONSISTENT: the staged items do not agree. Cancel the session and start a new replace.

For each other problem, you receive an error message that tells you what to do. Contact us at support@batch.com if you need more help.

Last updated