Skip to content
varsafe
Esc
↑↓navigate↵open⌘Jpreview

Create or update secrets in bulk

Writes many secrets to one environment in a single transaction. The intended path for importing an existing .env file.

POST/secrets/bulk
Request body
requiredapplication/json
projectIdstring<uuid>required
matches ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
environmentstringrequired
min length 1 · max length 50 · matches ^[a-z0-9][a-z0-9-]*$
secretsobject[]required
min items 1 · max items 100
Show properties
Array of object
keystringrequired
min length 1 · max length 255 · matches ^[A-Z][A-Z0-9_]*$
valuestringrequired
max length 65536
Responses
201Success.
createdintegerrequired
min 0 · max 9007199254740991
updatedintegerrequired
min 0 · max 9007199254740991
failedintegerrequired
min 0 · max 9007199254740991
resultsobject[]required
Show properties
Array of object
keystringrequired
statusstringrequired
Allowed:createdupdatedfailed
errorstring
400The request failed validation. `field` names the offending input.
statusCodeintegerrequired
HTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequired
Stable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequired
Human-readable explanation. Wording may change.
fieldstring
The offending request field, present on validation failures.
401No credential was presented, or it is invalid or revoked.
statusCodeintegerrequired
HTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequired
Stable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequired
Human-readable explanation. Wording may change.
fieldstring
The offending request field, present on validation failures.
403The credential is valid but lacks the required scope, role or team access.
statusCodeintegerrequired
HTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequired
Stable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequired
Human-readable explanation. Wording may change.
fieldstring
The offending request field, present on validation failures.
404The resource does not exist, or is not visible to this credential.
statusCodeintegerrequired
HTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequired
Stable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequired
Human-readable explanation. Wording may change.
fieldstring
The offending request field, present on validation failures.
429Rate limited. Retry after the interval named in the response.
statusCodeintegerrequired
HTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequired
Stable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequired
Human-readable explanation. Wording may change.
fieldstring
The offending request field, present on validation failures.
500Unexpected server error. The body never carries internal detail.
statusCodeintegerrequired
HTTP status code, repeated in the body.
min -9007199254740991 · max 9007199254740991
codestringrequired
Stable machine-readable error code, e.g. `SECRET_NOT_FOUND` or `FORBIDDEN`. Branch on this, never on the message.
messagestringrequired
Human-readable explanation. Wording may change.
fieldstring
The offending request field, present on validation failures.
Request
curl -X POST "https://api.varsafe.dev/secrets/bulk" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "<uuid>",
  "environment": "string",
  "secrets": [
    {
      "key": "string",
      "value": "string"
    }
  ]
}'
Response
{
  "created": 0,
  "updated": 0,
  "failed": 0,
  "results": [
    {
      "key": "string",
      "status": "created",
      "error": "string"
    }
  ]
}