secrets.sources.create

Connect a source — the credential is verified, then stored as a secret

POST /secrets/api/sourcesIAM secrets:CreateSecretSourceChanges state

Depending on the resource, the call checks secrets:CreateSecret instead; hold all of them to be sure it is allowed.

Request syntax

POST /secrets/api/sources
{
  "name": "string",
  "description": "string",
  "provider": "enum",
  "credential": "string",
  "config": "map of string",
  "keyId": "string",
  "refreshIntervalMinutes": "number"
}

Request body

  • nameRequired

    string

    The source’s name, 2 to 63 lower-case letters, digits and hyphens, unique in the organization (409 if taken). Its credential is stored as the secret SOURCE_<NAME>_TOKEN, which must not exist yet (409).

    Constraints: 2-63 chars, /^[a-z0-9][a-z0-9-]*$/

  • descriptionOptional

    string

    Free-text description, up to 256 characters

    Constraints: max 256 chars

  • providerRequired

    enum

    onepassword (a 1Password service account) or vault (HashiCorp Vault or OpenBao)

    One of: onepassword, vault

  • credentialRequired

    string

    The provider credential, 8 to 8192 characters: a 1Password service-account token (ops_…), a Vault token, or an AppRole secret ID. Verified with the provider before anything is stored (rejected: 422), then encrypted as a secret.

    Constraints: 8-8192 chars

  • configOptional

    map of string

    Provider settings, at most 16 keys, each value up to 512 characters. Vault/OpenBao: address (https, required), namespace, authMethod (token or approle), roleId and approleMount (AppRole). 1Password: none. Omitted: {}. Settings the provider does not accept are 400.

    Constraints: key=value

  • keyIdOptional

    string

    The KMS key the credential is encrypted under. Omitted: the organization’s default key, else its first enabled encrypt/decrypt key (none: 409). A key that is unknown, disabled or not encrypt/decrypt is 409.

    Constraints: uuid

  • refreshIntervalMinutesOptional

    number

    Minutes between scheduled syncs, 5 to 1440. Omitted: 60.

    Constraints: integer, 5-1440

Response

201 with { id, name }. 422 when the provider rejects the credential (nothing is stored); 409 for a taken name or credential secret name, no usable key, or a full quota.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow secrets:CreateSecretSource on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud secrets sources create --name example --provider onepassword --credential example

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_secrets_sources_create.