POST /versions/add

Add a variant to the project, optionally cloned from another one. Nothing is switched and nobody is moved.

/docs/api/versions-add.txt

POST https://api.pixydesignapp.com/versions/add

Add a variant, one of the project's parallel lines of edits. Main is the project itself. Every other variant is one the editor or this call made.

The new variant is left for the user to open. Nothing switches, and an editor already on the page stays where it is, because a key has no socket to stand anywhere.

Header: X-Pixy-Key carrying the agent key (px_sk_…).

Body:

field type required description
name string yes What the selector shows. Trimmed to 80 characters.
from string no A variant to clone. Its live edits are copied under new ids. Main's id is the project id, the one /me answers with. Without it the variant starts empty.

Response:

field type description
id string The new variant's id.
name string Its name, as stored.
copied number How many records the clone carried. 0 without a from.
versions array The project's whole list, Main first, in the shape /versions sets out.

Errors:

error when
invalid_key The key is not one of the project's, or was retired.
invalid_name name is empty.
no_version from names nothing this project owns.

Examples:

curl -X POST https://api.pixydesignapp.com/versions/add \
  -H 'X-Pixy-Key: px_sk_yourkey' \
  -H 'Content-Type: application/json' \
  -d '{"name": "Pricing, three columns"}'

A copy of Main to try something on:

curl -X POST https://api.pixydesignapp.com/versions/add \
  -H 'X-Pixy-Key: px_sk_yourkey' \
  -H 'Content-Type: application/json' \
  -d '{
        "name": "Pricing, three columns",
        "from": "0f6a9c31-5d2b-4a77-9c10-8e4b2f5d1a63"
      }'