---
title: "POST /vfields"
method: POST
path: "/vfields"
tags: ["vfields"]
---

# POST /vfields

`POST /vfields`

## Request

- Base URL: `https://api.axiom.co/v2`
- URL: `https://api.axiom.co/v2/vfields`
- Auth: OAuth 2
  - Authorization code: `https://accounts.google.com/o/oauth2/v2/auth`
  - Token URL: `https://www.googleapis.com/oauth2/v4/token` scopes: `virtualFields|create`
- TypeScript: <https://skmtc.dev/axiom/apis/axiom-public-api/docs/vfields/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a virtual field on a dataset. Axiom sets its ID to `<dataset>.<name>`, so the name must be unique within the dataset. `expression` must be a valid APL expression.

## Request body

- VirtualField
  - `dataset` string, required
  - `description` string
  - `expression` string, required
  - `name` string, required: Name of the virtual field. Use letters, digits, underscores, and hyphens, starting and ending with a letter or digit.
  - `type` string
  - `unit` string

## Response `200`

Created virtual field.

- VirtualFieldWithId
  - `dataset` string, required
  - `description` string
  - `expression` string, required
  - `name` string, required: Name of the virtual field. Use letters, digits, underscores, and hyphens, starting and ending with a letter or digit.
  - `type` string
  - `unit` string
  - `id` string, required

## Other responses

- `400`: Missing `dataset`, `name`, or `expression`, an invalid `name`, or an expression that doesn't parse.
- `403`: You don't have permission to create virtual fields on the dataset.
- `404`: You can't read the dataset.
- `409`: A virtual field with this name already exists on the dataset.

## Changes

- **2026-10-16** (v2) `fbc1b8430feb`: 4 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `403`
  - added the non-success response with the status `404`
  - added the non-success response with the status `409`

[Operation history](https://skmtc.dev/axiom/apis/axiom-public-api/changes/vfields/post.md)

---

[API](https://skmtc.dev/axiom/apis/axiom-public-api.md) - [All operations](https://skmtc.dev/axiom/apis/axiom-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/axiom/apis/axiom-public-api/revisions/7e39a295e3ba?raw)
