R4

Create Vault Item

Creates a new vault item with fields in the specified vault.

POST /api/v1/machine/vault/:vaultId/items

Headers

HeaderTypeRequiredDescription
X-API-KeystringYesYour API key
Content-TypestringYesMust be application/json

Path Parameters

ParameterTypeRequiredDescription
vaultIdstringYesThe unique identifier of the vault to add the item to

Request Body

FieldTypeRequiredDescription
namestringYesThe name of the vault item (max 255 characters)
typestringYesThe item type (see Item Types below)
websitesstring[]NoAssociated website URLs
fieldsarrayYesFields to create on the vault item

Field Object

FieldTypeRequiredDescription
namestringYesThe field label (e.g., "Username", "Password")
typestringYesThe field type (see Field Types below)
valuestringNoThe field value
isSecretbooleanNoOverride: force this field to be stored as a secret

Item Types

TypeDescription
LOGINLogin credentials (username/password)
API_KEYAPI key or token
DATABASEDatabase connection details
SSH_KEYSSH key pair
SERVERServer access credentials
SECURE_NOTEEncrypted text note
CREDIT_CARDPayment card information
CUSTOMCustom item with arbitrary fields

Field Types

TypeDefault SecretDescription
TEXTNoPlain text value
PASSWORDYesPassword (stored encrypted)
SECRETYesGeneric secret value
URLNoURL value
NUMBERNoNumeric value
TOTPYesTime-based one-time password seed
FILENoFile attachment reference

Response

Success (201 Created)

{
  "id": "507f1f77bcf86cd799439014"
}

Response Fields

FieldTypeDescription
idstringThe unique identifier of the newly created vault item

Error Responses

404 Not Found - Vault not found or not accessible

{
  "error": {
    "code": "vault_not_found",
    "message": "The vault with ID \"abc123\" was not found or you do not have access to it."
  }
}

400 Bad Request - Invalid request body

{
  "error": {
    "code": "vault_item_creation_failed",
    "message": "Failed to create the vault item. Please verify your input and try again."
  }
}

Example Request

curl -X POST "https://r4.dev/api/v1/machine/vault/507f1f77bcf86cd799439011/items" \
  -H "X-API-Key: rk_abc123def456.ghijklmnopqrstuvwxyz" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Database",
    "type": "LOGIN",
    "websites": ["https://db.example.com"],
    "fields": [
      {
        "name": "Host",
        "type": "TEXT",
        "value": "db.example.com"
      },
      {
        "name": "Port",
        "type": "NUMBER",
        "value": "5432"
      },
      {
        "name": "Username",
        "type": "TEXT",
        "value": "admin"
      },
      {
        "name": "Password",
        "type": "PASSWORD",
        "value": "super_secret_password"
      }
    ]
  }'

Use Cases

  • Secret provisioning: Programmatically store credentials generated during infrastructure deployment
  • Rotation automation: Create new vault items after rotating secrets
  • Migration: Bulk-import secrets from another secrets manager
  • CI/CD: Store build artifacts and deployment credentials automatically