Skip to main content

Archive Credential

Archives a specified Credential. Once archived, the Credential is no longer injected into sessions but can still be queried and restored. The archived_at field in the response is set to the archive time.

Prerequisites

Endpoint and authentication configured. For details, see Overview and authentication.

Endpoint

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

Path parameters

vault_id string (必选)Vault ID, format vlt_xxxcredential_id string (必选)Credential ID, format cred_xxx

Request example

curl -X POST "$AGENTSTUDIO_URL/vaults/vlt_xxx/credentials/cred_xxx/archive" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"

Response fields

id stringCredential ID, format cred_xxxtype stringAlways credentialvault_id stringVault ID that the Credential belongs todisplay_name stringHuman-readable name of the Credentialauth objectAuthentication information with sensitive values maskedmetadata objectCustom key-value pairsarchived_at stringArchive timestamp, ISO 8601created_at stringCreation time, ISO 8601updated_at stringLast update time, ISO 8601request_id stringUnique request identifier

Response example

{
  "id": "cred_xxx",
  "type": "credential",
  "vault_id": "vlt_xxx",
  "display_name": "Third-party API key",
  "auth": {
    "type": "environment_variable",
    "secret_name": "API_KEY",
    "networking": {
      "allowed_hosts": [
        "api.example.com",
        "*.example.com"
      ]
    },
    "injection_location": {
      "header": true
    }
  },
  "metadata": {},
  "archived_at": "2026-07-15T06:00:00Z",
  "created_at": "2026-07-10T08:00:00Z",
  "updated_at": "2026-07-15T06:00:00Z",
  "request_id": "req_xxx"
}

Error codes

HTTP statusError codeDescription
400InvalidParameterRequired parameter missing or invalid
401InvalidApiKeyInvalid API key provided