API Documentation
← Back to bah.is openapi.json

bah.is API

URL shortener API — create links, track analytics, manage domains, and more.

Base URL
https://api.bah.is
Version
1.0.0
Rate Limit
100 req / 15 min
Response Format
application/json

Authentication

COOKIE
Session Cookie

Set automatically after OAuth login. Used by the bah.is web app.

BEARER
API Key (Bearer Token)

Programmatic access using bah_xxxx keys. Enterprise plan only.
Pass as: Authorization: Bearer bah_your_api_key

Response Format

All responses follow a consistent envelope:

{
  "data": "… or null",
  "error": "… or null",
  "meta": "… or null"
}

System

Health and status

GET /health Health check No auth required

Responses

200 Service is healthy
{
  "status": "ok",
  "service": "api.bah.is"
}

Code Examples

curl -X GET "https://api.bah.is/health" \
  \
  -H "Authorization: Bearer bah_your_api_key" 

User

User profile and consent management

GET /v1/me Get current user profile Auth required

Responses

200 User profile
{
  "data": {
    "id": "abc",
    "email": "user@example.com",
    "name": "John",
    "plan": "pro"
  }
}

Code Examples

curl -X GET "https://api.bah.is/v1/me" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
PATCH /v1/me/consents Update marketing consent Auth required

Request Body

FieldTypeRequiredDescription
marketing boolean optional
{
  "marketing": true
}

Responses

200 Consent updated

Code Examples

curl -X PATCH "https://api.bah.is/v1/me/consents" \
  \
  -H "Authorization: Bearer bah_your_api_key"  \
  -H "Content-Type: application/json" \
  -d '{
  "marketing": true
}'

Analytics

Click analytics, real-time feed, export

GET /v1/analytics/overview Get analytics overview Auth required

Parameters

NameInTypeRequiredDescription
period query string (24h, 7d, 30d, 90d, 1y, all) optional
compare query boolean optional
linkId query string optional

Responses

200 Analytics data (locked for Free plan)

Code Examples

curl -X GET "https://api.bah.is/v1/analytics/overview" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
GET /v1/analytics/realtime Get real-time click feed Auth required

Last 20 clicks in real-time. Pro plan only.

Responses

200 Real-time click events

Code Examples

curl -X GET "https://api.bah.is/v1/analytics/realtime" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
GET /v1/analytics/export Export analytics data Auth required

Download analytics as CSV or JSON. Pro plan only.

Parameters

NameInTypeRequiredDescription
format query string (csv, json) optional
period query string optional

Responses

200 Downloaded file

Code Examples

curl -X GET "https://api.bah.is/v1/analytics/export" \
  \
  -H "Authorization: Bearer bah_your_api_key" 

Domains

Custom domain management (Pro)

GET /v1/domains List custom domains Auth required

Pro plan only.

Responses

200 List of domains

Code Examples

curl -X GET "https://api.bah.is/v1/domains" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
POST /v1/domains Add a custom domain Auth required

Pro plan only. Limit: 1 domain.

Request Body

FieldTypeRequiredDescription
domain string required
{
  "domain": "links.myco.com"
}

Responses

201 Domain created with DNS instructions
403 Pro plan required

Code Examples

curl -X POST "https://api.bah.is/v1/domains" \
  \
  -H "Authorization: Bearer bah_your_api_key"  \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "links.myco.com"
}'
GET /v1/domains/{id}/verify Check domain verification status Auth required

Parameters

NameInTypeRequiredDescription
id path string required

Responses

200 Current status

Code Examples

curl -X GET "https://api.bah.is/v1/domains/{id}/verify" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
DELETE /v1/domains/{id} Delete a custom domain Auth required

Parameters

NameInTypeRequiredDescription
id path string required

Responses

200 Domain deleted

Code Examples

curl -X DELETE "https://api.bah.is/v1/domains/{id}" \
  \
  -H "Authorization: Bearer bah_your_api_key" 

Buckets

Link buckets — multiple links in one URL (Pro)

GET /v1/buckets List link buckets Auth required

Pro plan only.

Responses

200 List of buckets

Code Examples

curl -X GET "https://api.bah.is/v1/buckets" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
POST /v1/buckets Create a link bucket Auth required

Bundle up to 10 links under one short URL. Pro plan only.

Request Body

FieldTypeRequiredDescription
name string required
slug string optional
links array required
{
  "name": "Resources",
  "slug": "resources",
  "links": []
}

Responses

201 Bucket created

Code Examples

curl -X POST "https://api.bah.is/v1/buckets" \
  \
  -H "Authorization: Bearer bah_your_api_key"  \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Resources",
  "slug": "resources",
  "links": []
}'

API Keys

Programmatic access keys (Enterprise)

GET /v1/keys List API keys Auth required

Enterprise plan only.

Responses

200 List of API keys (prefix only)

Code Examples

curl -X GET "https://api.bah.is/v1/keys" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
POST /v1/keys Create an API key Auth required

Enterprise plan only. Full key shown once.

Responses

201 API key created

Code Examples

curl -X POST "https://api.bah.is/v1/keys" \
  \
  -H "Authorization: Bearer bah_your_api_key" 
DELETE /v1/keys/{id} Revoke an API key Auth required

Parameters

NameInTypeRequiredDescription
id path string required

Responses

200 Key revoked

Code Examples

curl -X DELETE "https://api.bah.is/v1/keys/{id}" \
  \
  -H "Authorization: Bearer bah_your_api_key"