The User API

The User API allows you to make API requests that are scoped to an individual user.

This allows you to delegate the responsibility of ensuring a user has the required permissions to make a given request to UserHub.

It also makes it possible to call the UserHub API directly from the browser.

Create key

  1. Go to the Admin console and click API keys via the Developers dropdown or Tenant settings
  2. Click the New API key button
  3. Set the Description field to Getting Started
  4. Select User API from Type dropdown
  5. Select Read and write from the User scope dropdown
  6. Click the Create button
  7. Click Copy when the newly created key appears

Install SDK

# No setup required

Make an unauthenticated request

Use the User API key to make an unauthenticated API call to the session endpoint.

curl https://api.userhub.com/user/v1/session \
  -H "UserHub-Api-Key: $USER_API_KEY"

Make an authenticated request

Follow the instructions in the Admin API getting started guide and use those credentials to create an API session and make an authenticated call.

curl "https://api.userhub.com/admin/v1/users/$USER_ID:createApiSession" \
  -H "Authorization: Bearer $ADMIN_API_KEY" \
  -X POST

curl https://api.userhub.com/user/v1/session \
  -H "UserHub-Api-Key: $USER_API_KEY" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"

Most endpoints in the User API require that you provide a user access token, but some can be called with only the User API key.

PreviousCreate portal session
NextFlows

Turn users intorevenue
$

Subscribe to monthly product updates

© 2024 UserHub

Integrations

    UserHub & Auth0UserHub & Stripe BillingUserHub & Google CloudUserHub & FirebaseUserHub & custom auth