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
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
201
Resource created successfully
application/json
Responseobject
post
POST /2.6/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

Was this helpful?