Archive credential

Updated at:

Archive a credential. This Bailian extension has no restore endpoint.

Endpoint

Paths are relative to the Base URL. Send Authorization: Bearer $DASHSCOPE_API_KEY on every request. For authentication details, see Authentication.

POST/vaults/{vault_id}/credentials/{credential_id}/archive

Path parameters

vault_idstringRequired

Parent vault ID. Treat it as an opaque ID

credential_idstringRequired

Credential ID. Treat it as an opaque ID

The request has no body.

Request example

curl -sS -X POST "$BASE_URL/vaults/vlt_xxx/credentials/vcrd_xxx/archive" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"
import os
import requests

resp = requests.post(
    f"{os.environ['BASE_URL']}/vaults/vlt_xxx/credentials/vcrd_xxx/archive",
    headers={"Authorization": f"Bearer {os.environ['DASHSCOPE_API_KEY']}"},
)
print(resp.json())

Response fields

200, returns the archived credential:

idstring

Credential ID

objectstring

Credential object type, fixed as vault.credential

vault_idstring

Parent vault ID

namestring

Display name

created_atinteger

Creation time in Unix seconds

updated_atinteger

Last update time in Unix seconds

metadataobject

Metadata, string key-value pairs; {} when not set

auth

typestring

Authentication type, fixed as environment_variable

secret_namestring

Environment variable name

networking

typestring

Network access type, limited or unrestricted

allowed_hostsarray

Domains or IPv4 addresses allowed for limited

The response does not return archived_at, status, secret_value, the key identifier, or injection_location. An archived credential can still be retrieved, and the default list includes both active and archived. There is no restore endpoint. Archiving a vault also archives its child credentials.

Response example

{
  "id": "vcrd_xxx",
  "object": "vault.credential",
  "vault_id": "vlt_xxx",
  "name": "crm-token",
  "created_at": 1793941200,
  "updated_at": 1793944800,
  "metadata": {"team": "support"},
  "auth": {
    "type": "environment_variable",
    "secret_name": "CRM_TOKEN",
    "networking": {
      "type": "limited",
      "allowed_hosts": ["api.example.com"]
    }
  }
}

Error codes

For the error response structure, see Errors.

HTTP statusError type / codeSolution
401authentication_error / invalid_api_keySend a valid Authorization: Bearer $DASHSCOPE_API_KEY header
404not_found_error / not_found_errorThe credential does not exist, is deleted, does not belong to the parent vault, or belongs to another workspace
500server_error / server_errorRetry later. If it keeps failing, submit a ticket with x-request-id