# App settings

> What a merchant set for your app, and pictures your components show.

Source: https://storeware.ai/docs/api-reference/rest/app-settings

## Get what the merchant set for your app

`GET /api/v1/app/settings`

Every field your installed release declares in `[[settings]]`, by its `key`: what the merchant saved, else its `default`, else null. A `secret` comes back in the clear, to your app alone. A key an older release declared and yours no longer does is left out. When the merchant saves, you are sent `app.settings_updated.v1` with the keys that changed.

Answers only your app’s own token for the shop, and needs no permission.

**Answers** `200`

| Field | Type | Description |
| --- | --- | --- |
| `data` | object |  |
| `data.values` | map of string or number or boolean or null |  |
| `data.updatedAt` | string (date-time) or null | When the merchant last saved, or null when they never have. |

```bash
curl "https://api.storeware.ai/api/v1/app/settings" \
  -H "Authorization: Bearer $TOKEN"
```

## Put a picture on Storeware for your components

`POST /api/v1/app/assets`

Stores a PNG, JPEG, WebP, GIF or AVIF picture of at most 5 MB, for this shop, and answers with its address on `cdn.mystoreware.com`, the one host an image in your components may come from. Its bytes are checked, so the type you send must be the type it is; SVG is refused. Sending the same picture again gives the same address.

Answers only your app’s own token for the shop, and needs no permission.

**Body**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | string | Yes | The picture’s bytes, as base64. At most 5 MB of picture. 1 to 6,990,508 characters. Matches `^[A-Za-z0-9+/]+={0,2}$`. |
| `contentType` | string | Yes | What the picture is. It must match the bytes, which are checked. One of `image/png`, `image/jpeg`, `image/webp`, `image/gif`, `image/avif`. |

**Answers** `201`

| Field | Type | Description |
| --- | --- | --- |
| `data` | object |  |
| `data.url` | string | Where the picture is served from. Use it in an image node. |
| `data.contentType` | string |  |
| `data.sizeBytes` | integer |  |
| `data.sha256` | string | The hash of the bytes, which names the file. |

```bash
curl -X POST "https://api.storeware.ai/api/v1/app/assets" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d @body.json
```
