Skip to content

Bootstrap the measurement window

POST
/v1/embed/init
curl --request POST \
--url https://api.tryyoursize.com/v1/embed/init \
--header 'Content-Type: application/json' \
--header 'TYS-Publishable-Key: <TYS-Publishable-Key>' \
--data '{ "parent_origin": "example" }'

Key: publishable (pk_test_… / pk_live_…), from an origin registered for the key.

Called when the measurement window opens. Checks the publishable key and that the brand page embedding the window (parent_origin) is allowed for the store.

Media typeapplication/json
object
parent_origin
required

Origin of the brand page that opened the window, e.g. https://shop.example

string

Example generated

{
"parent_origin": "example"
}

The store the window works for

Media typeapplication/json
object
store_name
required
string
mode
required
string
Allowed values: test live

Example

{
"mode": "test"
}

Missing or invalid credentials

Media typeapplication/json

Every error has this shape. error is a human-readable message, status the HTTP status. code is stable and machine-readable; doc_url links its explanation; request_id identifies the request (also in the X-Request-ID response header): quote it to support.

object
error
required
string
status
required
integer
code

Stable error code, e.g. invalid_request, unauthorized, reauth_required, payment_required, forbidden, not_found, conflict, unprocessable, rate_limited, internal_error, not_implemented, unavailable, invalid_api_version, idempotency_key_in_use, idempotency_key_reused, invalid_idempotency_key, handle_expired, handle_invalid.

string
doc_url
string format: uri
request_id
string

Example

{
"code": "not_found",
"doc_url": "https://docs.tryyoursize.com/api/errors/#not_found"
}

Not allowed

Media typeapplication/json

Every error has this shape. error is a human-readable message, status the HTTP status. code is stable and machine-readable; doc_url links its explanation; request_id identifies the request (also in the X-Request-ID response header): quote it to support.

object
error
required
string
status
required
integer
code

Stable error code, e.g. invalid_request, unauthorized, reauth_required, payment_required, forbidden, not_found, conflict, unprocessable, rate_limited, internal_error, not_implemented, unavailable, invalid_api_version, idempotency_key_in_use, idempotency_key_reused, invalid_idempotency_key, handle_expired, handle_invalid.

string
doc_url
string format: uri
request_id
string

Example

{
"code": "not_found",
"doc_url": "https://docs.tryyoursize.com/api/errors/#not_found"
}

Was this page helpful?