NextPay Docs
Guide

Authentication

How to authenticate with the NextPay API

NextPay uses a device code flow for authentication, similar to CLI tools like GitHub CLI.

Device Code Flow

  1. Request a device codePOST /v1/auth/device-code
  2. User authorizes — Direct the user to the verification URL
  3. Poll for tokenGET /v1/auth/device-code/{code} until authorized
  4. Exchange for tokenPOST /v1/auth/token

Using Tokens

Include the token in the Authorization header:

curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://api.nextpay.world/v1/auth/me

Token Refresh

Tokens expire after a set period. Use the refresh token to obtain a new access token without re-authenticating.

On this page