# Update catalog

Use `/catalogs/update` to update an existing catalog.

## Update

> Updates an existing 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_action":{"type":"string","description":"Action to perform on a catalog field during updates.","enum":["add","remove"]},"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-202":{"description":"Request accepted for asynchronous processing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmptyResponse"}}}}}},"paths":{"/catalogs/update":{"post":{"operationId":"catalog_update","summary":"Update","description":"Updates an existing 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":"Identifier of the catalog to update."},"fields":{"description":"List of fields to add or remove from the catalog.","type":"array","minItems":1,"items":{"type":"object","required":["action","name"],"properties":{"action":{"$ref":"#/components/schemas/field_action"},"name":{"type":"string","description":"The name of the field to add or remove.","pattern":"[a-z0-9_]+$","minLength":1,"maxLength":250},"type":{"$ref":"#/components/schemas/field_type"}}}}}}}}},"responses":{"202":{"$ref":"#/components/responses/responses-202"},"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 update an existing catalog:

`/catalogs/update`&#x20;

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": [
        {
            "action": "add",
            "name": "director",
            "type": "string"
        },
        {
            "action": "remove",
            "name": "duration"
        }
    ]
}
```

## Responses

### Success

If the call to the API endpoint is successful you will receive an **HTTP 202** 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.
