Skip to main content
POST
/
workflows
/
vault
Create a vault item
curl --request POST \
  --url https://v1.api.altostrat.io/workflows/vault \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "name": "My App's API Token",
  "secret": "sec_abc123def456",
  "expires_at": "2026-10-31T10:00:00Z"
}
EOF
import requests

url = "https://v1.api.altostrat.io/workflows/vault"

payload = {
    "name": "My App's API Token",
    "secret": "sec_abc123def456",
    "expires_at": "2026-10-31T10:00:00Z"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: 'My App\'s API Token',
    secret: 'sec_abc123def456',
    expires_at: '2026-10-31T10:00:00Z'
  })
};

fetch('https://v1.api.altostrat.io/workflows/vault', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://v1.api.altostrat.io/workflows/vault",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => 'My App\'s API Token',
    'secret' => 'sec_abc123def456',
    'expires_at' => '2026-10-31T10:00:00Z'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://v1.api.altostrat.io/workflows/vault"

	payload := strings.NewReader("{\n  \"name\": \"My App's API Token\",\n  \"secret\": \"sec_abc123def456\",\n  \"expires_at\": \"2026-10-31T10:00:00Z\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://v1.api.altostrat.io/workflows/vault")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"My App's API Token\",\n  \"secret\": \"sec_abc123def456\",\n  \"expires_at\": \"2026-10-31T10:00:00Z\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://v1.api.altostrat.io/workflows/vault")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"My App's API Token\",\n  \"secret\": \"sec_abc123def456\",\n  \"expires_at\": \"2026-10-31T10:00:00Z\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "vlt_01h3j4k5l6m7n8p9q0r1s2t3u4",
  "name": "External Service API Key",
  "created_at": "2025-10-31T10:00:00.000000Z",
  "expires_at": "2026-10-31T10:00:00.000000Z"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}
{
  "type": "invalid_request_error",
  "code": "parameter_missing",
  "message": "The 'name' parameter is required for this request.",
  "doc_url": "https://docs.altostrat.io/errors/parameter_missing"
}

Authorizations

Authorization
string
header
required

Standard JWT for user sessions obtained via Altostrat authentication.

Body

application/json
name
string
required

A descriptive name for the secret. To generate an API Key, prefix the name with api-key:.

Example:

"My App's API Token"

secret
string

The secret value to store. This field should be omitted when creating an API key.

Example:

"sec_abc123def456"

expires_at
string<date-time> | null

An optional expiration date for the secret.

Example:

"2026-10-31T10:00:00Z"

Response

The vault item was created successfully.

id
string

The unique prefixed identifier for the vault item.

Example:

"vlt_01h3j4k5l6m7n8p9q0r1s2t3u4"

name
string

The name of the vault item. For API keys, use the api-key: prefix.

Example:

"External Service API Key"

created_at
string<date-time>

The timestamp when the item was created.

Example:

"2025-10-31T10:00:00.000000Z"

expires_at
string<date-time> | null

The timestamp when the item expires and can no longer be used.

Example:

"2026-10-31T10:00:00.000000Z"