Documentation
Quick Start
- Create an API key
curl -X POST https://inbox.dog/api/keys -H "Content-Type: application/json" -d '{"name": "my-app"}' - Redirect users to authenticate
https://inbox.dog/oauth/authorize? client_id=YOUR_CLIENT_ID& redirect_uri=https://yourapp.com/callback& scope=email - Exchange code for tokens
curl -X POST https://inbox.dog/oauth/token -H "Content-Type: application/json" -d '{ "code": "AUTH_CODE", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" }'
API Keys
Create an API key to get your client_id and client_secret.
Create Key
POST /api/keys
Content-Type: application/json
{"name": "my-app"} Response:
{
"client_id": "id_abc123...",
"client_secret": "sk_xyz789...",
"name": "my-app",
"credits": 10
} Check Key Info
GET /api/keys/{client_id}
X-Client-Secret: YOUR_CLIENT_SECRET OAuth Flow
Standard OAuth 2.0 authorization code flow:
- Redirect user to
/oauth/authorize - User authenticates with Google
- User is redirected back to your
redirect_uriwith a code - Exchange code for tokens at
/oauth/token
Authorization Request
GET /oauth/authorize?
client_id=YOUR_CLIENT_ID&
redirect_uri=https://yourapp.com/callback&
scope=email&
state=random_state_value | Parameter | Required | Description |
|---|---|---|
| client_id | Yes | Your API key client ID |
| redirect_uri | Yes | Where to redirect after auth |
| scope | No | Permission scope (default: email) |
| state | No | Opaque value for CSRF protection |
Token Exchange
Exchange the authorization code for access tokens:
POST /oauth/token
Content-Type: application/json
{
"code": "AUTH_CODE_FROM_CALLBACK",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
} Response:
{
"access_token": "ya29.a0AfH6...",
"refresh_token": "1//0eXyz...",
"token_type": "Bearer",
"expires_in": 3600,
"email": "user@example.com"
} Refresh Tokens
Use the refresh token to get new access tokens:
POST /oauth/token
Content-Type: application/json
{
"grant_type": "refresh_token",
"refresh_token": "YOUR_REFRESH_TOKEN",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
} Scopes
| Scope | Gmail Permission |
|---|---|
| Read-only access (default) | |
| email:read | Read-only access |
| email:send | Send emails only |
| email:full | Full access (read, send, modify) |
Billing
Each OAuth token exchange costs 1 credit. New API keys come with 10 free credits.
Purchase more credits:
POST /api/checkout
Content-Type: application/json
{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"credits": 100
} Returns a Stripe checkout URL. Price: $0.10 per credit.