Skip to content

Auth Endpoints

Endpoints for account creation via GitHub OAuth.

GET /v1/auth/github/url

Get the GitHub OAuth authorization URL.

bash
curl https://api.payre.dev/v1/auth/github/url?role=developer

Query Parameters:

ParamRequiredDescription
roleYesdeveloper or consumer

Response:

json
{
  "url": "https://github.com/login/oauth/authorize?client_id=xxx&scope=read:user,user:email&state=developer"
}

POST /v1/auth/github

Exchange a GitHub OAuth code for a Payre account.

bash
curl -X POST https://api.payre.dev/v1/auth/github \
  -H "Content-Type: application/json" \
  -d '{"code": "github_oauth_code_here", "role": "developer"}'

Request Body:

FieldTypeRequiredDescription
codestringYesGitHub OAuth authorization code
rolestringYesdeveloper or consumer

Response:

json
{
  "id": "dev_xxx",
  "email": "dev@example.com",
  "name": "Developer Name",
  "secretKey": "pyr_sk_live_xxx",
  "role": "developer"
}

Account creation is idempotent -- if the email already exists, the existing account is returned.

Health Check

GET /health

bash
curl https://api.payre.dev/health

Response:

json
{
  "status": "ok",
  "service": "@payre/api",
  "uptime": 12345
}

No authentication required.