Design on the live site in the editor the user has open: one call is one step of edits, landing in their history, nothing in the source changes.
/docs/api/edit.txtPOST https://api.pixydesignapp.com/edit
Design on the live site without touching the source. One call is one step of edits, each stored as a record, the same rows the editor writes when the user drags something: the user sees the design the next time the site is open in Pixy, an editor that is open shows it at once, the edits log lists every record, and what they do not like they delete there. Nothing needs to be open while you work. When the user says the design is right, a pull ships the records to be built like any others.
Header: X-Pixy-Key carrying the agent key (px_sk_…).
Body:
| field | type | required | description |
|---|---|---|---|
edits |
array | yes | The commands below. Every one is checked before any is stored: a step is stored whole or not at all. |
url |
string | for elements | The page, by its key (/pricing, /). Element and add commands need it, a rule reaches every page. |
context |
object | no | {"screen_size": [1440, 900], "theme": "light"}, the screen the design is for, kept on every record of the step. |
space |
string | no | The space, by id, when the project has several. As in pull. |
Targets are CSS selectors on the page as the site serves it, the markup you know from the source, or a record's id: from an earlier answer, for the element a step just added, or from a pull, for an element the user already edited, whose record then takes your change.
A rule, one style for everything a selector matches, the way the user's class target writes. The command for a component: every button, every card.
{"rule": ".btn", "css": {"border-radius": "6px", "padding": "12px 20px"}}
A rule sits in the site's own cascade: it comes after the site's sheets at normal weight, so it wins at equal or higher specificity and loses below it. Where the site sets the same property with #view > #story > .editor, a rule on .editor alone paints nothing. Match the site's selector and add to it, or go through the element command, whose styles are written !important on that one element.
An element, the first element the selector matches on the page, with one record of its own. One command may carry several of these.
| key | what it does |
|---|---|
css |
Styles on the element itself: {"font-size": "32px"}. "" clears what Pixy set, "unset" takes the site's declaration off. |
text |
What the element says, as plain text. |
html |
What the element holds, as markup. |
attributes |
{"href": "/signup", "target": null}: a value sets, null removes. |
classes |
{"add": ["btn-primary"], "remove": ["btn"]}. |
move |
Stands it in another parent: {"into": "#main", "index": 2}, the index among the parent's children, last unsaid. into takes a selector or a record's id. |
remove |
true takes it off the page. |
{"element": "#hero h1", "text": "Pricing that scales with you", "css": {"font-size": "48px"}}
A new element, from markup, stood in a parent the way a move stands one:
{"add": "<section class=\"cta\"><h2>Ready?</h2><a class=\"btn\" href=\"/signup\">Start</a></section>", "into": "#main", "index": 3}
The markup is the whole element to make, children included. Give it classes the site's rules already style and it looks like the site at once. Its record's id comes back in the answer, a target and an into for the next step.
An image the design needs goes up first, with media: the path it answers, media/<file>, is what you write in an src attribute, in html, or in a style's url() such as background-image.
A record made here is stored knowing nothing of what the site gave a key: its original is empty, and an element has no snapshot or home. The first editor to show the record fills them in from the page, so by the time anyone pulls a design the user has looked at, the record reads like any other. Its class holds the difference alone, the names added in set.class, the names taken off in original.class, "" for none.
Response:
| field | type | description |
|---|---|---|
records |
array | Every record the step touched as it now stands, the shape pull sets out. A record emptied by the step, every key cleared again, is here with no changes. |
space |
string | The space the step went to. |
Errors:
| error | when |
|---|---|
invalid_key |
The key is not one of the project's, or was retired. |
which_space |
The project has several spaces and none was named. The answer carries spaces: ask the user which. |
no_url |
An element or add command without a url. |
invalid_edit |
edits is empty, a command names no rule, element or add, a rule has no css, an element command no key from the table, or add is not markup. The answer carries selector when a command has one. Nothing was stored. |
Example:
curl -X POST https://api.pixydesignapp.com/edit \
-H 'X-Pixy-Key: px_sk_yourkey' \
-H 'Content-Type: application/json' \
-d '{
"url": "/pricing",
"context": {"screen_size": [1440, 900], "theme": "light"},
"edits": [
{"rule": ".btn", "css": {"border-radius": "6px"}},
{"element": "#plans .price", "css": {"font-size": "32px"}},
{"element": "#old-banner", "remove": true}
]
}'