# Create catalog

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

## Create

> Creates a new catalog.

```json
{"openapi":"3.1.0","info":{"title":"Batch - REST API","version":"2.9"},"tags":[{"name":"Catalogs"}],"servers":[{"url":"https://api.batch.com/{version}","description":"production","variables":{"version":{"default":"2.11","description":"Version of the API"}}}],"security":[{"rest_key":[]}],"components":{"securitySchemes":{"rest_key":{"type":"http","scheme":"bearer","description":"## API Key Authentication\n\nAuthentication is required in order to interact with Batch's APIs.\n\nBatch implements authentication using API Keys, that we call the \"REST API Key\".\nYou can find it on your dashboard.\n\nPlease make sure that you keep this key secret. You should never use it in client apps to call APIs from there as it would\neasily be extractable.\n\n### How to authenticate\n\nIn order to authenticate your requests, add your REST API Key in the `Authorization` header and prefix it by `Bearer`. Example: `Authorization: Bearer bcd38d9rfb38ra28`.\n"}},"parameters":{"HeaderProjectKey":{"in":"header","name":"X-Batch-Project","description":"The unique project key, identifying a project on the Batch platform","schema":{"type":"string"},"required":true}},"schemas":{"field":{"description":"A field defines a single attribute type that items in the catalog can have. Each field has a unique name and a type.","type":"object","required":["name","type"],"properties":{"name":{"type":"string","description":"The name of the field as it will appear on catalog items.","pattern":"[a-z0-9_]+$","minLength":1,"maxLength":250},"type":{"$ref":"#/components/schemas/field_type","description":"The data type for this field, such as integer or string."}}},"field_type":{"type":"string","description":"Enumerates the possible data types allowed for catalog fields.","enum":["array","bool","date","float","integer","string","url"]},"EmptyResponse":{"type":"object"},"Error":{"type":"object","required":["error_message","error_code"],"properties":{"error_message":{"description":"A human readable error message","type":"string"},"error_code":{"description":"Error code","type":"string"}}}},"responses":{"400":{"description":"The request is malformed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"The Rest API Key is not valid for this project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too Many Requests","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Batch's services are under maintenance. Please try again later","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"responses-201":{"description":"Resource created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmptyResponse"}}}}}},"paths":{"/catalogs/create":{"post":{"operationId":"catalog_create","summary":"Create","description":"Creates a new catalog.","tags":["Catalogs"],"parameters":[{"$ref":"#/components/parameters/HeaderProjectKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","fields"],"properties":{"name":{"type":"string","description":"Unique identifier of the catalog."},"fields":{"type":"array","description":"List of fields defining the catalog schema.","minItems":1,"maxItems":25,"items":{"$ref":"#/components/schemas/field"}}}}}}},"responses":{"201":{"$ref":"#/components/responses/responses-201"},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"429":{"$ref":"#/components/responses/429"},"500":{"$ref":"#/components/responses/500"},"503":{"$ref":"#/components/responses/503"}}}}}}
```

### Request structure

#### Route

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

`/catalogs/create`&#x20;

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](https://doc.batch.com/developer/api/cep/..#request-headers-and-authentication).

#### Post data

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

Here is a how a complete JSON payload looks like:

```json
{
    "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.
