# Update global settings

URL: https://docs.sparklayer.io/developers/api/core/update-global-setting
Operation: `PATCH /api/v1/settings` (operationId `patchGlobalSetting`)
OpenAPI spec: https://docs.sparklayer.io/openapi/core.yaml

Updates one or more store-wide settings, sent as an array of `key`/`value` pairs, and returns `204`. Only a fixed set of setting keys can be updated.

API keys created in the SparkLayer Dashboard can't update global settings: the request is rejected with the message "Global settings unavailable for updates, please contact support". Contact support if you need to change them.

`PATCH /api/v1/settings`

**Base URLs:** `https://app.sparklayer.io` (Live), `https://test.app.sparklayer.io` (Test)

**Authentication:** send `Authorization: Bearer <access_token>` and `Site-Id: <site id>` with every request. Get the token from [Get an access token](https://docs.sparklayer.io/developers/api/core/get-an-access-token.md); see [Authentication](https://docs.sparklayer.io/developers/authentication.md).

### Example request

```bash
curl -X PATCH "https://app.sparklayer.io/api/v1/settings" \
  -H "Authorization: Bearer $SPARKLAYER_TOKEN" \
  -H "Site-Id: $SPARKLAYER_SITE_ID" \
  -H "Content-Type: application/json" \
  -d '[
  {
    "key": "<key>",
    "value": null
  }
]'
```

Set `SPARKLAYER_TOKEN` to an access token and `SPARKLAYER_SITE_ID` to your Site ID. For the test environment, use `https://test.app.sparklayer.io`.

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Site-Id` | string | Yes | Your SparkLayer Site ID, from Settings > API in the SparkLayer Dashboard. Example: `jones-climbing` |

### Request body (`application/json`) (required)

An array. Each item:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `[].key` | string | Yes | |
| `[].value` | any \| null | Yes | |

```json
[
  {
    "key": "<key>",
    "value": null
  }
]
```

### Responses

#### 204: The settings were updated. No body.

#### Other statuses: An error. The body describes the problem: see [Errors](https://docs.sparklayer.io/developers/errors.md).

`application/problem+json`: the standard error body (below).

### Error body

Error responses with a body use this RFC 7807 problem details object. See [Errors](https://docs.sparklayer.io/developers/errors.md) for every status code and which errors to retry.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `detail` | string | | Human-readable summary of the error |
| `status` | integer | | HTTP Status code returned from API |
| `title` | string | | Machine-readable error code |
| `type` | string \| null | | |
| `errors` | object[] \| null | | A list of errors related to the call |
| `errors[].code` | string | | Machine-readable error code |
| `errors[].property` | string | | The property the error relates to |
| `errors[].message` | string | | Human readable summary of the error |

```json
{
  "detail": "Data Validation Failed",
  "status": 400,
  "title": "invalid-api-request-contents",
  "type": "https://docs.sparklayer.io/api/errors#invalid-api-request-contents",
  "errors": [
    {
      "code": "resource-not-found",
      "property": "stock_location_id",
      "message": "stock_location_id not found"
    }
  ]
}
```
