---
title: "Keep a secret a build needs - a key or a password - out of its code"
url: https://xovris.ai/docs/api/operations/putcodeprojectsbyidsecretsbyname/
---

# Keep a secret a build needs - a key or a password - out of its code

`PUT /v1/code/projects/{id}/secrets/{name}`

Needs a token that can read and change. A token without change access is refused with `token_read_only` and the step to take.

## Parameters

- `id` (string, path, required)
- `name` (string, path, required)

## Request body

### `application/json`

- `value` (string)
- `hosts` (any[])

Example:

```json
{
  "value": "string",
  "hosts": [
    null
  ]
}
```

## Answers

- `200`: Done. (application/json: T848ee09e2642)
- `401`: Not signed in: the token is missing, expired or revoked. The answer says how to get a new one. (application/json: Problem)
- `403`: Signed in, but this token or role may not do this. The answer names the permission it needs. (application/json: Problem)
- `404`: Nothing with that id here, or it belongs to another workspace. Nothing was changed. (application/json: Problem)
- `default`: Any other refusal or failure. The answer says what happened and what to do next. (application/json: Problem)

## A call

The address is https://api.xovris.ai/v1/code/projects/{id}/secrets/{name} - put your own value in place of each part in braces.

```sh
curl --request PUT \
  --url 'https://api.xovris.ai/v1/code/projects/{id}/secrets/{name}' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"value":"string","hosts":[null]}'
```
