Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Create a vault

client.beta.agents.vaults.create(VaultCreateParams { metadata, name } body?, RequestOptionsoptions?): Vault { id, created_at, metadata, 2 more }
POST/vaults

Creates a vault for the current project. See vaults.

ParametersExpand Collapse
body: VaultCreateParams { metadata, name }
metadata?: Record<string, string> | null

Key-value pairs to associate with the vault, such as an application or team identifier.

name?: string

The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming.

minLength1
maxLength1048576
ReturnsExpand Collapse
Vault { id, created_at, metadata, 2 more }

A collection of credentials for MCP servers and OpenAI-hosted environments.

id: string

The ID of the vault.

minLength0
created_at: number

The Unix timestamp, in seconds, when the vault was created.

formatint64
metadata: Record<string, string>

Key-value pairs associated with the vault, such as an application or team identifier.

name: string | null

The human-readable name of the vault, if set.

minLength0
object: "vault"

The object type. Always vault.

Create a vault

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const vault = await client.beta.agents.vaults.create();

console.log(vault.id);
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}
Returns Examples
{
  "id": "id",
  "created_at": 0,
  "metadata": {
    "foo": "string"
  },
  "name": "name",
  "object": "vault"
}