Skip to content

User API

The User API lets your servers do what the SDK does in the browser, plus a few things the browser cannot:

  • Create or update a user, with their company, before they ever open your app.
  • Keep attributes such as plan or seat count in sync from your billing system or CRM.
  • Track events that happen outside the browser, such as a payment or a background job.
  • Delete users, or reset their UserGuiding history so they see onboarding again.
  • Export page views, material events and custom events for your own analytics.

Use the host for your account’s data region. A key only works on its own region’s host.

Region Base URL
US https://user.userguiding.com
EU https://eu-user.userguiding.com

Every request needs your project’s API key in the UG-API-KEY header. Find or create the key in the panel under Settings > Project Settings > MCP & API Key.

Terminal window
curl https://user.userguiding.com/public/user/user_123 \
-H "UG-API-KEY: $USERGUIDING_API_KEY"

Create a user, or update them if they already exist, and attach them to a company:

Terminal window
curl -X PUT https://user.userguiding.com/public/user/user_123 \
-H "UG-API-KEY: $USERGUIDING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"attributes": {
"email": "[email protected]",
"plan": "growth"
},
"company": {
"company_id": "acme",
"company_name": "Acme Inc.",
"company_attributes": { "seats": 25 }
}
}'

The response is 201 Created for a new user and 200 OK for an existing one, with the full user object in both cases.

Each project can send bursts of up to 2,000 requests, and the allowance refills at 20 requests per second. Requests to all endpoints share it. When it runs out, the API answers 429 Too Many Requests with a Retry-After header that says how many seconds to wait. Requests that get a 429 do not use up the allowance.

GET /public/user and GET /public/event use cursor pagination.

  1. Make the first request without search_after.
  2. Read search_after from the response and send it on the next request. Keep every other parameter the same.
  3. Stop when the page comes back empty. For events, you can also stop when a page holds fewer items than page_size.
import os
import requests
url = "https://user.userguiding.com/public/event"
headers = {"UG-API-KEY": os.environ["USERGUIDING_API_KEY"]}
params = {
"start": "2026-09-01T00:00:00Z",
"end": "2026-09-30T23:59:59Z",
"type": "custom",
"page_size": 1000,
}
while True:
page = requests.get(url, headers=headers, params=params, timeout=30).json()
for event in page["events"]:
handle(event)
if len(page["events"]) < params["page_size"]:
break
params["search_after"] = page["search_after"]

Event queries cover at most 90 days per request and return up to 1,000 events per page.

Errors return a JSON body with a detail field.

Status Meaning
401 The API key is invalid, or belongs to the other data region.
403 The UG-API-KEY header is missing.
404 The user does not exist.
422 The request failed validation. detail lists each invalid field.
429 You went over the rate limit. Wait the number of seconds in the Retry-After header.
500 Something went wrong on our side. Retry with backoff.

Each endpoint page has an interactive playground. Pick your region’s server and paste your API key to try it.