VYG Docs

Quickstart

Create an API key and make your first request to the VYG API.

Create an API key and retrieve your top five customers by total spend.

1. Create an API key

  1. Sign in to VYG as a brand admin. Open Settings → API Keys for a VYG API key (vyg_…), or Settings → Data API Keys for a conversations and providers key (vyg_ba_…).

  2. Create a key and choose its permissions (scopes). For this guide, a VYG API key with customers:read is enough.

  3. Copy the key. It is shown once. Put it in your secret manager.

Keys can also be created over the API with POST /v1/keys; see API keys.

Store the key in an environment variable so it never lands in source control:

export VYG_API_KEY="vyg_your_key_here"

2. Make your first request

Send the key as a bearer token. This request returns your top five customers by total spend:

curl -s "https://api.vyg.app/v1/customers?sort=total_spend&direction=desc&limit=5" \
  -H "Authorization: Bearer $VYG_API_KEY"

A successful response is a page of customers with a cursor:

{
	"data": [
		{
			"id": "8f2b0c1e-5d7a-4b7e-9a51-2c6f1e0d3a44",
			"email": "jane@example.com",
			"phone": "+15551234567",
			"orders_count": 12,
			"total_spend": 1840.5,
			"last_order_at": "2026-06-20T14:30:00.000Z"
		}
	],
	"next_cursor": null
}

From here:

  • Filter with min_orders or min_spend. The parameters are in the Customers reference.
  • Page through results by passing next_cursor back as cursor while it is not null.
  • Fetch one customer, with their identities, with GET /v1/customers/{id}. A single record is returned as a bare object, not wrapped in data.

3. If something goes wrong

Statuserror.codeWhat to check
401unauthorizedThe Authorization header is missing, or the key is wrong, revoked or expired.
403insufficient_scopeThe key needs additional permissions, or customer data features are unavailable.
404not_foundThe record could not be found.

See Errors for the full list.

Next steps

On this page