bah.is API
URL shortener API — create links, track analytics, manage domains, and more.
Authentication
Set automatically after OAuth login. Used by the bah.is web app.
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
/health
Health check
No auth required
Responses
{
"status": "ok",
"service": "api.bah.is"
}
Code Examples
curl -X GET "https://api.bah.is/health" \
\
-H "Authorization: Bearer bah_your_api_key"
Links
Create, read, update, delete short links
/v1/links
List links
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
page |
query | integer | optional | |
limit |
query | integer | optional | |
search |
query | string | optional |
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/links" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/links
Create a short link
No auth required
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
url |
string | required | Destination URL |
slug |
string | optional | Custom slug (optional) |
title |
string | optional | Link title (optional) |
domain |
string | optional | Custom domain (optional, Pro only) |
{
"url": "https://example.com/my-page",
"slug": "my-link",
"title": "My Link",
"domain": "links.myco.com"
}
Responses
{
"data": {
"id": "abc123",
"slug": "my-link",
"shortUrl": "https://bah.is/my-link",
"destination": "https://example.com/my-page",
"title": "My Link"
},
"error": null,
"meta": null
}
Code Examples
curl -X POST "https://api.bah.is/v1/links" \
\
-H "Authorization: Bearer bah_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/my-page",
"slug": "my-link",
"title": "My Link",
"domain": "links.myco.com"
}'
/v1/links/{id}
Get link details
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required |
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/links/{id}" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/links/{id}
Update a link
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
url |
string | optional | |
slug |
string | optional | |
title |
string | optional |
{
"url": "example_url",
"slug": "example_slug",
"title": "example_title"
}
Responses
Code Examples
curl -X PUT "https://api.bah.is/v1/links/{id}" \
\
-H "Authorization: Bearer bah_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "example_url",
"slug": "example_slug",
"title": "example_title"
}'
/v1/links/{id}
Delete a link
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required |
Responses
Code Examples
curl -X DELETE "https://api.bah.is/v1/links/{id}" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/links/{id}/qr
Get QR code for a link
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required |
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/links/{id}/qr" \
\
-H "Authorization: Bearer bah_your_api_key"
User
User profile and consent management
/v1/me
Get current user profile
Auth required
Responses
{
"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"
/v1/me/consents
Update marketing consent
Auth required
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
marketing |
boolean | optional |
{
"marketing": true
}
Responses
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
/v1/analytics/overview
Get analytics overview
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
period |
query | string (24h, 7d, 30d, 90d, 1y, all) | optional | |
compare |
query | boolean | optional | |
linkId |
query | string | optional |
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/analytics/overview" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/analytics/realtime
Get real-time click feed
Auth required
Last 20 clicks in real-time. Pro plan only.
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/analytics/realtime" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/analytics/link/{id}
Get analytics for a specific link
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required | |
period |
query | string | optional |
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/analytics/link/{id}" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/analytics/export
Export analytics data
Auth required
Download analytics as CSV or JSON. Pro plan only.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
format |
query | string (csv, json) | optional | |
period |
query | string | optional |
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/analytics/export" \
\
-H "Authorization: Bearer bah_your_api_key"
Domains
Custom domain management (Pro)
/v1/domains
List custom domains
Auth required
Pro plan only.
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/domains" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/domains
Add a custom domain
Auth required
Pro plan only. Limit: 1 domain.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string | required |
{
"domain": "links.myco.com"
}
Responses
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"
}'
/v1/domains/{id}/verify
Check domain verification status
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required |
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/domains/{id}/verify" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/domains/{id}
Delete a custom domain
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required |
Responses
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)
/v1/buckets
List link buckets
Auth required
Pro plan only.
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/buckets" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/buckets
Create a link bucket
Auth required
Bundle up to 10 links under one short URL. Pro plan only.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | required | |
slug |
string | optional | |
links |
array | required |
{
"name": "Resources",
"slug": "resources",
"links": []
}
Responses
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)
/v1/keys
List API keys
Auth required
Enterprise plan only.
Responses
Code Examples
curl -X GET "https://api.bah.is/v1/keys" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/keys
Create an API key
Auth required
Enterprise plan only. Full key shown once.
Responses
Code Examples
curl -X POST "https://api.bah.is/v1/keys" \
\
-H "Authorization: Bearer bah_your_api_key"
/v1/keys/{id}
Revoke an API key
Auth required
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | required |
Responses
Code Examples
curl -X DELETE "https://api.bah.is/v1/keys/{id}" \
\
-H "Authorization: Bearer bah_your_api_key"