---
title: "Upload rules.js; validates and stores a draft version. activate: true also makes it live and requires previewId from a passing preview of exactly this rulesJs (30 minutes; 409 preview_required otherwise)"
method: POST
path: "/api/me/versions"
tags: ["owner"]
---

# Upload rules.js; validates and stores a draft version. activate: true also makes it live and requires previewId from a passing preview of exactly this rulesJs (30 minutes; 409 preview_required otherwise)

`POST /api/me/versions`

## Request

- Base URL: `https://daycal.io`
- URL: `https://daycal.io/api/me/versions`
- Auth: HTTP bearer

## Request body

- object
  - `rulesJs` string, required
  - `note` string
  - `activate` boolean
  - `previewId` string

## Response `201`

Stored

- object
  - `versionId` integer
  - `bookingUrl` string
  - `handle` string
  - `warnings` string[]
  - `planNote` string: Free plan only, at most weekly: the one note about Pro

## Other responses

- `401`: Missing, unknown, expired or revoked token: sign in again (RFC 6750 invalid_token)
- `403`: Outside this token's access (RFC 6750 insufficient_scope): the owner scopes are read, write, billing and secrets; the challenge names the ones to sign in again for
- `429`: Rate limited. Retry-After is set when a rate-limit window is spent (not on a booking's own budget)
- `default`: Error

---

[API](https://skmtc.dev/daycal/apis/daycal-api.md) · [All operations](https://skmtc.dev/daycal/apis/daycal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/daycal/apis/daycal-api/revisions/7103ffff4e8c?raw)
