API Reference

Complete REST API documentation for What'sYour.Info. Build powerful integrations with our comprehensive API.

Base URL

All developer API requests should be made to:

REST API v1
https://whatsyour.info/api/v1

Authentication

Our API uses a simple, secure token-based authentication system.

API Key

A permanent secret key for server-to-server authentication.

Example Header

Authorization: Bearer wyi_live_1234567890abcdef...

Usage

Use this key ONLY to authenticate with the /api/v1/auth/login endpoint to get a short-lived JWT.

Bearer Token (JWT)

A short-lived token used to access protected user resources.

Example Header

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Usage

Obtained from the login endpoint. Use this for all calls to /api/v1/me.

OAuth 2.0

Standard flow for applications acting on behalf of other users.

Example Header

Authorization: Bearer oauth_access_token_...

Usage

Use this when you need users to grant your app permission to access their data.

API Endpoints

Complete reference for all available endpoints.

Public Endpoints (v1)

Access public data without authentication.

GET
/api/v1/profile/{username}
Auth: None

Get public profile information for a specific user.

Example Response

{
  "username": "johndoe",
  "firstName": "John",
  "bio": "Software engineer...",
  "isProUser": true,
  "links": [],
  "design": {}
}
GET
/api/v1/avatars/{username}
Auth: None

Get a user's avatar image.

Example Response

Binary image data (e.g., image/png)

Authentication API (v1)

Authenticate and get a short-lived token for further requests.

POST
/api/v1/auth/login
Auth: API Key

Exchange a permanent API Key for a short-lived JWT.

Request Body

{}

Example Response

{
  "message": "Authentication successful",
  "token_type": "Bearer",
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_in": 3600
}

Authenticated User API (v1)

Manage the user profile associated with your access token.

GET
/api/v1/me
Auth: Bearer Token

Get the complete profile of the authenticated user.

Example Response

{
  "_id": "...",
  "username": "johndoe",
  "email": "user@example.com",
  "bio": "...",
  "links": [
    {
      "title": "Portfolio",
      "url": "..."
    }
  ]
}
PUT
/api/v1/me
Auth: Bearer Token

Update fields on the authenticated user's profile.

Request Body

{
  "firstName": "John",
  "bio": "My updated bio.",
  "links": [
    {
      "title": "My Website",
      "url": "https://example.com"
    }
  ],
  "design": {
    "theme": "nite"
  }
}

Example Response

{
  "message": "Profile updated successfully."
}

Developer Management API

Manage your own developer resources like API keys and OAuth apps.

GET
/api/dev/stats
Auth: Cookie (Web UI)

Get usage statistics for your developer account.

Example Response

{
  "apiKeys": 1,
  "oauthClients": 0,
  "apiCalls": 150,
  "rateLimit": "1,000/hr"
}
GET
/api/dev/keys
Auth: Cookie (Web UI)

List all of your API keys.

Example Response

{
  "keys": [
    {
      "_id": "...",
      "name": "Production Key",
      "key": "wyi_...",
      "lastUsed": "..."
    }
  ]
}
POST
/api/dev/keys
Auth: Cookie (Web UI)

Create a new API key.

Request Body

{
  "name": "My New App Key"
}

Example Response

{
  "message": "API key created successfully",
  "key": {}
}
DELETE
/api/dev/keys/{keyId}
Auth: Cookie (Web UI)

Permanently delete an API key.

Example Response

{
  "message": "API key deleted successfully"
}

OAuth API (v1)

Standard OAuth 2.0 Authorization Code flow for third-party applications to securely access user data on their behalf.

GET
/oauth/authorize
Auth: None (User Session)

The first step of the OAuth flow. Redirect the user to this endpoint to request their permission for your application to access their data.

Parameters

NameTypeRequiredDescription
client_idstring
Required
The Client ID of your registered OAuth Application.
redirect_uristring
Required
The callback URL where the user will be sent after authorization. Must exactly match one of the URIs in your app settings.
response_typestring
Required
Must be the literal string "code".
scopestring
Required
A space-delimited list of permissions your app is requesting. Example: "profile:read email:read".
statestring
Optional
An opaque value used to prevent CSRF attacks. It will be returned to you in the redirect.

Example Response

Redirects the user to your `redirect_uri` with an authorization `code` and the original `state` in the query parameters upon success. On failure, it redirects with an `error` parameter.
POST
/api/v1/oauth/token
Auth: None

The second step of the OAuth flow. Your server exchanges an authorization code or a refresh token for a new access token.

Request Body

{
  "grant_type": "\"authorization_code\" or \"refresh_token\"",
  "client_id": "your_client_id",
  "client_secret": "your_client_secret",
  "//--- If": "grant_type is \"authorization_code\" ---",
  "code": "the_authorization_code_from_the_redirect",
  "redirect_uri": "the_exact_same_redirect_uri_from_the_first_step",
  "//--- Or if": "grant_type is \"refresh_token\" ---",
  "refresh_token": "the_refresh_token_from_a_previous_exchange"
}

Example Response

{
  "access_token": "wyi_at_new_access_token...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "wyi_rt_a_brand_new_refresh_token...",
  "scope": "profile:read email:read",
  "//--- IMPORTANT!": "Refresh Token Rotation is enabled. Each time you use a refresh token, you will receive a NEW refresh token in the response. You MUST save this new one for future use, as the old one is immediately invalidated."
}

Rate Limits

API usage limits to ensure fair usage and system stability

Free Tier

  • • 1,000 requests per hour
  • • 10,000 requests per day
  • • Public API access only

Pro Tier

  • • 10,000 requests per hour
  • • 100,000 requests per day
  • • Full API access
  • • Priority support

Rate limit headers: All responses include rate limit information in headers:X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

Error Codes

Standard HTTP status codes and error responses

200
OK
Request successful
400
Bad Request
Invalid request parameters
401
Unauthorized
Authentication required or invalid
403
Forbidden
Access denied
404
Not Found
Resource not found
429
Too Many Requests
Rate limit exceeded
500
Internal Server Error
Server error