# Update a string

`PUT https://app.shuttleglobal.com/c/api/instances/{instance_key}/strings/{string_id}`

Replaces the wording of one string for one language.

- The fields go inside a `string` object. The string is identified by the id in the URL.
- `language` and `branding` are read from the body, not the query string. Leaving out
  `language` writes the `default` (base) wording, not a translation.
- Sending the wording the string already inherits removes your override instead of storing
  it, so the string goes back to the inherited wording.
- Saving the first string in a language adds that language. There is no separate step to
  add a language.

The change applies to checkouts opened after it is saved. A checkout session that was already
created keeps the wording it was created with until it expires.

## Authentication

- basicAuth: Basic Authentication using secret key
- bearerAuth: OAuth 2.0 Bearer Token Authentication

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `string_id` | path | string | yes | The string's `id`, e.g. `web.payment_form.card_number`. |

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

- `string` (object, required)
  - `text` (string, required): The new wording
  - `language` (string): Lowercase two-letter ISO 639-1 language code, or `default`. Defaults to `default`, so send it when writing a translation
  - `branding` (string): Enterprise field, for accounts with more than one branding. Leave out to use your own branding

## Responses

### 200: The string as it now reads

```json
{
  "string": {
    "id": "web.payment_form.card_number",
    "text": "رقم البطاقة",
    "language": "ar",
    "branding": "string",
    "overriding": "Card Number"
  }
}
```

### 400: Bad request

```json
{
  "code": "string",
  "message": "string"
}
```

### 401: Authentication required

```json
{
  "code": "UNAUTHORIZED",
  "message": "Unauthorised"
}
```

## Example request

```sh
curl --request PUT \
  --url https://app.shuttleglobal.com/c/api/instances/YOUR_INSTANCE_KEY/strings/STRING_ID \
  --header 'Authorization: Basic <base64 of SECRET_KEY:>' \
  --header 'Content-Type: application/json' \
  --data '{
  "string": {
    "text": "رقم البطاقة",
    "language": "ar"
  }
}'
```

Reference page: https://docs.shuttleglobal.com/platforms/reference/operations/updatestring/