---
title: "corestack_deployments_company_secret_set"
url: https://docs.corefinity.com/mcp/tools/corestack_deployments_company_secret_set
type: tool
last_updated: 2026-11-13
feature: deployment-templates
related:
  - https://docs.corefinity.com/api/reference/deployments/create-company-deploy-secret.md
  - https://docs.corefinity.com/guides/sites/code-and-deployments/deployment-templates.md
---
# corestack_deployments_company_secret_set

**Set a company registry secret.** Add or change an npm or Composer registry secret your company's sites' builds install with (secret_id updates one), and optionally verify it with the registry. The token is write-only. Scope: write.

- Scope: `write`
- Runs as a task: no

## When to use it

Add or change an npm or Composer registry secret your company's sites' builds install with, and optionally verify it with the registry. Without `secret_id` it creates one (`kind`, `registry`, `token`); with it, it changes what you send (never the kind); `secret_id` with `verify: true` alone verifies a stored one. `shared_with_managed` matters only for an agency: the secret then also reaches the builds of the sites it manages for clients. An environment's own secret for the same registry wins over the company's. The token and username are write-only. A token restricted to some sites cannot change company secrets.

The same action in the public REST API, with the same checks, refusals and scope: `POST /api/corestack/companies/{company}/deploy-secrets` (a new secret) and `PUT /api/corestack/companies/{company}/deploy-secrets/{secret}` (`secret_id`).

## Inputs

- `secret_id` (integer, ≥ 1): Update this secret.
- `kind` (string, one of `npm`, `composer`): On create.
- `label` (string)
- `registry` (string): npm: an https:// URL; Composer: the host.
- `scope` (string, at most 214 characters): npm: @scope.
- `auth_type` (string, one of `http-basic`, `bearer`, `github-oauth`, `gitlab-token`): Composer.
- `username` (string): Composer http-basic.
- `token` (string)
- `shared_with_managed` (boolean): An agency only: also the sites it manages for clients.
- `verify` (boolean): Ask the registry once.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "auth_type": {
      "description": "Composer.",
      "enum": [
        "http-basic",
        "bearer",
        "github-oauth",
        "gitlab-token"
      ],
      "type": "string"
    },
    "kind": {
      "description": "On create.",
      "enum": [
        "npm",
        "composer"
      ],
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "registry": {
      "description": "npm: an https:// URL; Composer: the host.",
      "type": "string"
    },
    "scope": {
      "description": "npm: @scope.",
      "maxLength": 214,
      "type": "string"
    },
    "secret_id": {
      "description": "Update this secret.",
      "minimum": 1,
      "type": "integer"
    },
    "shared_with_managed": {
      "description": "An agency only: also the sites it manages for clients.",
      "type": "boolean"
    },
    "token": {
      "type": "string"
    },
    "username": {
      "description": "Composer http-basic.",
      "type": "string"
    },
    "verify": {
      "description": "Ask the registry once.",
      "type": "boolean"
    }
  },
  "type": "object"
}
```

## Refusals

- `forbidden`: the person's role lacks the Edit Environment Deployment Pipeline permission, which every change to the
  company's templates, variables and registry secrets needs (they reach every environment that follows the template). The
  message names it and says an owner of the company can grant it in Roles; `details.permission` is
  `editEnvironmentDeploymentPipeline`. Nothing is changed.
- `exists`: a secret for that registry and scope is already saved; update it with its `secret_id` (in `details.id`).
- `secret_invalid`: the registry is not an HTTPS address on the public internet, or a field is not valid.
- `too_many_secrets`: the company already holds the most registry secrets it can (20); delete one first.
- `upstream_unavailable`: the registry could not be asked; try again later.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_deployments_company_secret_set",
  "arguments": {
    "kind": "npm",
    "label": "GitHub Packages",
    "registry": "https://npm.pkg.github.com",
    "scope": "@acme",
    "token": "<the registry token>",
    "shared_with_managed": false,
    "verify": true
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_deployments_company_secret_set with kind npm, label GitHub Packages, registry https://npm.pkg.github.com, scope @acme, token <the registry token>, shared_with_managed false, verify true. (Set a company registry secret.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/companies/{company}/deploy-secrets](https://docs.corefinity.com/api/reference/deployments/create-company-deploy-secret.md)
- Guide: [Deployment templates](https://docs.corefinity.com/guides/sites/code-and-deployments/deployment-templates.md)
