Get a widget
const url = 'https://api.getsitecontrol.com/v1/sites/1/widgets/1';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.getsitecontrol.com/v1/sites/1/widgets/1 \ --header 'Authorization: Bearer <token>'One widget with everything List widgets gives, plus its content (pages, texts, fields, buttons), the notification_emails its responses are sent to, and who created and last edited it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Widget id from List widgets
Widget id from List widgets
Responses
Section titled “Responses”object
The widget’s first headline, plain text; null when it has none
Where the widget sits on the page, named as in the admin. modal: a window centred over the page. bar: a strip across the top or bottom of the page. panel: a box attached to the bottom of the screen, opened from its header. slide_in: a box that slides in from a corner. sidebar: a panel attached to the left or right edge of the screen. fullscreen: covers the whole screen. inline: placed inside the page content. other: a layout the admin no longer offers. “Pop-up” is not a layout: users call any widget a pop-up.
object
object
0 is General, where items outside any folder are
Event types the widget can produce besides show and close
object
Has an e-mail field
Has a phone field
A button copies or applies a discount code
Has a game: a wheel, a scratch card or a reveal
Has a countdown timer
Has a teaser, the small tab shown before or after it
ReCAPTCHA checks its form submits
A new subscriber confirms the address by e-mail first
Submits with disposable or untrusted e-mail addresses are rejected
Responses are e-mailed: switched on, with a recipient
In an A/B test, named in ab_test_group
An integration, webhook or Zapier switched on sends its responses
You have a draft of it with unsaved changes, see draft
object
False when some rules could not be read into the blocks below
Informational notes; wording is not stable, do not parse
Null when the block could not be read
object
object
All: every item must hold; any: one is enough.
object
All: every item must hold; any: one is enough.
object
How a condition tests its value; any_of and none_of take a list, during and not_during a range, has_any_value and is_undefined no value.
object
Immediate: on page load; programmatically: only when the site’s code
shows it; triggers: when one of triggers fires.
object
What fires a show or a hide; a *_seconds or *_percent trigger carries its threshold in value.
object
object
What fires a show or a hide; a *_seconds or *_percent trigger carries its threshold in value.
object
object
The visitor’s event after which the widget stops showing; close and show are named for their event. action: after the visitor submits it or clicks its button. hide: after a hide trigger hides it. show_count: after count shows.
object
All: every item must hold; any: one is enough.
object
All: every item must hold; any: one is enough.
object
Date: a range of days; time: a range of hours in a time zone; weekday: days of the week, 0 is Sunday.
How a condition tests its value; any_of and none_of take a list, during and not_during a range, has_any_value and is_undefined no value.
object
object
Your draft of this widget while it has unsaved changes; null when it has none
object
New: started with create_widget_draft and not saved yet; the widget exists only in this draft. draft: your unsaved changes over the saved widget. synced: the draft matches the saved widget.
The draft’s revision: 1 when it started, one more per change; null when you have no draft of this widget
True: the widget was saved after your draft started, and saving would replace that save
Who made that save, when saved_changed; e-mail or name
When they saved, when saved_changed
When this draft started; a draft that started before this conversation is unfinished work, maybe yours
Last change to the draft
One permanent page per widget: your draft while it has unsaved changes, the saved widget otherwise, refreshed as you edit; null where live previews are not set up
Informational notes about the widget itself; wording is not stable, do not parse
Last change of the widget itself; a move to another folder does not change it
Last change made in the editor
Parts shortened in the list, as paths; the card has them whole. Empty when nothing was cut
object
False for widgets whose content cannot be read; lists are empty
object
object
What a content block is. header: the panel header above every page;
page: a page, label is its name; group: a container of other blocks;
text: copy in text; button: with its text in label; field: a form
field, games included, see type; marquee: a scrolling line, copy in
text; image: an Image, in the flow of the content; floating_image: a
Floating image, placed over the page at an offset from a corner;
progress: a progress bar towards a goal, no copy published; countdown: a
timer to a date or for a duration, no copy published; other: any other
block, no copy published.
Widget: the panel header, shown with no page in particular. page: a block of the page page_ref. teaser: a block of the teaser.
This block’s ref, as widget config reads and edits name it
The block this one is nested in
Full plain text, not HTML
Visible label of a field or a button
Technical name of a field, its name in responses
Type of a field, the same value as type of this field in responses
Choices of a select, radio or checkbox field, or the prizes of a game (name is the prize code)
object
What a response stores: name of an option in its value
Visible text, plain; null when the option shows none
Top of a rating (1 to max) or an NPS (0 to max) scale; a response stores the answer as the option name, e.g. “4”
object
What a content block is. header: the panel header above every page;
page: a page, label is its name; group: a container of other blocks;
text: copy in text; button: with its text in label; field: a form
field, games included, see type; marquee: a scrolling line, copy in
text; image: an Image, in the flow of the content; floating_image: a
Floating image, placed over the page at an offset from a corner;
progress: a progress bar towards a goal, no copy published; countdown: a
timer to a date or for a duration, no copy published; other: any other
block, no copy published.
Widget: the panel header, shown with no page in particular. page: a block of the page page_ref. teaser: a block of the teaser.
This block’s ref, as widget config reads and edits name it
The block this one is nested in
Full plain text, not HTML
Visible label of a field or a button
Technical name of a field, its name in responses
Type of a field, the same value as type of this field in responses
Choices of a select, radio or checkbox field, or the prizes of a game (name is the prize code)
object
What a response stores: name of an option in its value
Visible text, plain; null when the option shows none
Top of a rating (1 to max) or an NPS (0 to max) scale; a response stores the answer as the option name, e.g. “4”
Where responses are e-mailed; whether they are is features.notifications
Null when unknown: before authors were recorded, by an API key, or by a user deleted since
object
Null for Support or for a user who was deleted
Null when the user has no name
The user’s sign-in e-mail; null for Support
Last change made in the editor; null when unknown: before authors were recorded, by an API key, or by a user deleted since
object
Null for Support or for a user who was deleted
Null when the user has no name
The user’s sign-in e-mail; null for Support
{ "layout": "modal", "targeting": { "audience": { "match": "all", "segments": [ { "match": "all", "conditions": [ { "operator": "is" } ] } ] }, "start": { "mode": "immediate", "triggers": [ { "type": "exit_intent" } ] }, "hide": { "triggers": [ { "type": "exit_intent" } ] }, "stop": { "rules": [ { "event": "action", "mode": "forever" } ] }, "schedule": { "match": "all", "segments": [ { "match": "all", "conditions": [ { "key": "date", "operator": "is" } ] } ] } }, "draft": { "state": "new" }, "truncated": [], "content": { "pages": [ { "blocks": [ { "kind": "header", "surface": "widget", "type": "email" } ] } ], "teaser": [ { "kind": "header", "surface": "widget", "type": "email" } ] }}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
Authentication scheme: Bearer
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
Seconds until the bucket refills
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds