---
title: "Update a promotion"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.nicer.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a promotion

Path: Nicer API › Company config

`PUT /config/promotion/{promotionId}`

URL: `https://api.nicer.travel/config/promotion/{promotionId}`

Changes any of the editable fields of one of the agency's promotions, leaving the rest as they are, and answers the promotion as saved. Only the agency's admins may call it. Errors: 404 ERROR_ITEM_NOT_FOUND for a promotion the agency does not have; 400 ERROR_COMPANY_REQUIRED for a request that names no agency.

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Path parameters

- `promotionId` (`config.promotion.update.path.promotionId`; string, required)

## Header parameters

- `x-nicer-company` (`config.promotion.update.header.x-nicer-company`; string, optional) — Company context for an agency admin who belongs to several companies. Optional when the caller belongs to one.

## Request body

_Required._

- `buttonName` (`config.promotion.update.buttonName`; string, optional)
- `description` (`config.promotion.update.description`; string, optional)
- `endDate` (`config.promotion.update.endDate`; string, optional)
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
- `images` (`config.promotion.update.images`; array of string, optional)
  - minLength: `1`
- `price` (`config.promotion.update.price`; string, optional)
- `startDate` (`config.promotion.update.startDate`; string, optional)
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
- `tag` (`config.promotion.update.tag`; object, optional)
  - `color` (`config.promotion.update.tag.color`; string, required)
    - minLength: `1`
  - `name` (`config.promotion.update.tag.name`; string, required)
    - minLength: `1`
- `title` (`config.promotion.update.title`; string, optional)
  - minLength: `1`
- `status` (`config.promotion.update.status`; string, optional)
  - one of `"published"`, `"draft"`, `"deactivated"`

## Example request

```json
{
  "buttonName": "string",
  "description": "string",
  "endDate": "2019-08-24T14:15:22Z",
  "images": [
    "string"
  ],
  "price": "string",
  "startDate": "2019-08-24T14:15:22Z",
  "tag": {
    "color": "string",
    "name": "string"
  },
  "title": "string",
  "status": "published"
}
```

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
});

await nicer.config.promotion.update({
  "promotionId": "string"
});
```

### Nicer CLI

```bash
nicer config promotion update --promotion-id 'string' --input - <<'JSON'
{}
JSON
```

### cURL

```bash
curl --request PUT \
  --url 'https://api.nicer.travel/config/promotion/<promotionId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "buttonName": "string",
  "description": "string",
  "endDate": "2019-08-24T14:15:22Z",
  "images": [
    "string"
  ],
  "price": "string",
  "startDate": "2019-08-24T14:15:22Z",
  "tag": {
    "color": "string",
    "name": "string"
  },
  "title": "string",
  "status": "published"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/config/promotion/<promotionId>';
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    buttonName: 'string',
    description: 'string',
    endDate: '2019-08-24T14:15:22Z',
    images: ['string'],
    price: 'string',
    startDate: '2019-08-24T14:15:22Z',
    tag: {color: 'string', name: 'string'},
    title: 'string',
    status: 'published'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/config/promotion/<promotionId>"

payload = {
    "buttonName": "string",
    "description": "string",
    "endDate": "2019-08-24T14:15:22Z",
    "images": ["string"],
    "price": "string",
    "startDate": "2019-08-24T14:15:22Z",
    "tag": {
        "color": "string",
        "name": "string"
    },
    "title": "string",
    "status": "published"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "buttonName": "string",
  "companyName": "string",
  "createdBy": "string",
  "description": "string",
  "endDate": "2019-08-24T14:15:22Z",
  "images": [
    "string"
  ],
  "lastModifiedBy": "string",
  "price": "string",
  "startDate": "2019-08-24T14:15:22Z",
  "status": "published",
  "tag": {
    "color": "string",
    "name": "string"
  },
  "title": "string",
  "promotionId": "string",
  "type": "Promotion",
  "createdAt": "string",
  "updatedAt": "string"
}
```

- `buttonName` (`config.promotion.update.response.200.buttonName`; string, required)
- `companyName` (`config.promotion.update.response.200.companyName`; string, required)
- `createdBy` (`config.promotion.update.response.200.createdBy`; string, required)
- `description` (`config.promotion.update.response.200.description`; string, required)
- `images` (`config.promotion.update.response.200.images`; array of string, required)
  - minLength: `1`
- `lastModifiedBy` (`config.promotion.update.response.200.lastModifiedBy`; string, required)
- `status` (`config.promotion.update.response.200.status`; string, required)
  - one of `"published"`, `"draft"`, `"deactivated"`
- `title` (`config.promotion.update.response.200.title`; string, required)
  - minLength: `1`
- `promotionId` (`config.promotion.update.response.200.promotionId`; string, required)
  - pattern: `^PROMO.*`
- `type` (`config.promotion.update.response.200.type`; string, required)
- `createdAt` (`config.promotion.update.response.200.createdAt`; string, required)
- `updatedAt` (`config.promotion.update.response.200.updatedAt`; string, required)
- `endDate` (`config.promotion.update.response.200.endDate`; string, optional)
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
- `price` (`config.promotion.update.response.200.price`; string, optional)
- `startDate` (`config.promotion.update.response.200.startDate`; string, optional)
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
- `tag` (`config.promotion.update.response.200.tag`; object, optional)
  - `color` (`config.promotion.update.response.200.tag.color`; string, required)
    - minLength: `1`
  - `name` (`config.promotion.update.response.200.tag.name`; string, required)
    - minLength: `1`

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`config.promotion.update.response.400.errorCode`; string, required)
- `errorMessage` (`config.promotion.update.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`config.promotion.update.response.401.errorCode`; string, required)
- `errorMessage` (`config.promotion.update.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`config.promotion.update.response.403.errorCode`; string, required)
- `errorMessage` (`config.promotion.update.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Company-config/config.promotion.update/index.md
