Create catalog

Use /catalogs/create to create a new catalog. You are allowed to create up to 5 catalogs per project.

Create

post

Creates a new catalog.

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
Body
namestringRequired

Unique identifier of the catalog.

Example: products
Responses
post
/catalogs/create
POST /2.8/catalogs/create HTTP/1.1
Host: api.batch.com
Authorization: Bearer YOUR_SECRET_TOKEN
X-Batch-Project: text
Content-Type: application/json
Accept: */*
Content-Length: 62

{
  "name": "products",
  "fields": [
    {
      "name": "price",
      "type": "float"
    }
  ]
}
{}

Request structure

Route

The Catalog API exposes a POST endpoint that allows to create an audience:

/catalogs/create

You will be allowed to create up to 5 catalogs for a project. A catalog can have up to 25 fields.

Headers and authentication

See Overview → Using Project APIs.

Post data

The body of the request must contain a valid JSON payload describing the operations to be executed on the audience.

Here is a how a complete JSON payload looks like:

{
    "name": "MOVIES",
    "fields": [
        {
            "name": "director",
            "type": "string"
        },
        {
            "name": "title",
            "type": "string"
        },
        {
            "name": "release_year",
            "type": "integer"
        },
        {
            "name": "cast",
            "type": "array"
        }
        {
            "name": "description",
            "type": "string"
        }
    ]
}

Responses

Success

If the call to the API endpoint is successful you will receive an HTTP 201 confirmation.

Failure

If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at support@batch.com if you need further support.

Last updated