---
title: "Update a company registry secret"
url: https://docs.corefinity.com/api/reference/deployments/update-company-deploy-secret
type: endpoint
last_updated: 2026-11-13
feature: deployment-templates
related:
  - https://docs.corefinity.com/guides/sites/code-and-deployments/deployment-templates.md
---
# Update a company registry secret

Changes the fields you send, keeps the rest and answers the whole list. `verify` true on its own checks the
saved credential with its registry without changing it.

```http
PUT /api/corestack/companies/{company}/deploy-secrets/{secret}
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 10 a minute
- Try it in the console: off. It has not been cleared for the console. Copy the request and run it yourself when you are sure.

## Path parameters

- `company` (integer, required): The id of a company you belong to or manage. Digits only.
- `secret` (integer, required): The id of a registry secret of this company, as the list answers it. Digits only.

## Body

- `auth_type` (string) One of `http-basic`, `bearer`, `github-oauth`, `gitlab-token`.
- `label` (string)
- `registry` (string)
- `scope` (string)
- `shared_with_managed` (boolean): For an agency only, also give the credential to the sites it manages for its clients.
- `token` (string)
- `username` (string)
- `verify` (boolean): Ask the registry whether it accepts the credential, after any change in the same request.

## Request

### curl

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/companies/1204/deploy-secrets/318 \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Example packages"
  }'
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->put('https://manage.corefinity.com/api/corestack/companies/1204/deploy-secrets/318', [
        'label' => 'Example packages',
    ]);

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/companies/1204/deploy-secrets/318', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    label: 'Example packages',
  }),
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.put(
    "https://manage.corefinity.com/api/corestack/companies/1204/deploy-secrets/318",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "label": "Example packages",
    },
)

data = res.json() if res.content else None
```

## Responses

### 200 The company's registry secrets after the change, with `verification` when the registry was asked.

```json
{
  "can_share": true,
  "data": [
    {
      "auth_type": "bearer",
      "id": 318,
      "kind": "composer",
      "label": "Example packages",
      "last4": "oken",
      "last_used_at": null,
      "registry": "repo.example.com",
      "scope": "",
      "shared_with_managed": false,
      "used_by": {
        "environments": 1,
        "overridden_on": 0
      },
      "verified_at": null
    }
  ]
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the scope (`scope_required`, with the `scope` to use: `write`, or `exec` for a reveal and for a change that brings a new command), your company requires two-factor authentication and you have not set it up, or your role lacks the Edit Environment Deployment Pipeline permission (`forbidden`, with `permission`).

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The id does not exist or is something you cannot see, or the feature is not on for your company (`feature_off`).

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 409 The company already has a credential for this registry and scope (`exists`, with the saved one's `id`). Change that one instead.

```json
{
  "code": "exists",
  "id": 318,
  "message": "A registry for this host is already saved. Edit it instead.",
  "reason": "exists"
}
```

### 422 The request was refused and nothing was saved. `errors` names the field. - `secret_invalid`: a value the rules refuse (the label, the registry, the scope, the sign-in type, the username for `http-basic`, the token), or a registry whose address is not public or does not resolve. - `too_many_secrets`: the company holds as many registry secrets as it can. - `invalid`: a field of the wrong type or one this endpoint does not take (the token is `token`), a `scope` longer than 214 characters, or a change that names nothing to change and no `verify` true (on `secret_id`).

```json
{
  "code": "secret_invalid",
  "errors": {
    "auth_type": [
      "Choose how the registry signs in: http-basic, bearer, github-oauth or gitlab-token."
    ]
  },
  "message": "Choose how the registry signs in: http-basic, bearer, github-oauth or gitlab-token.",
  "reason": "secret_invalid"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `company_unavailable` | Your company is unavailable. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 403 | `forbidden` | The person is not allowed to do this. |
| 403 | `two_factor_required` | Turn on two-factor on your account, then send again. |
| 404 | `feature_off` | This feature is not on for your organisation yet. |
| 409 | `exists` | It already exists. Use the existing one. |
| 422 | `secret_invalid` | Choose how the registry signs in: http-basic, bearer, github-oauth or gitlab-token. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 422 | `too_many_secrets` | This company already has the most registry secrets it can hold. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Deployment templates](https://docs.corefinity.com/guides/sites/code-and-deployments/deployment-templates.md)
