API key authentication
For programmatic access to H0p, use API keys. API keys provide:- Persistent access - No need to handle login flows
- Granular permissions - Control exactly what each key can do
- Organization scope - Keys are tied to a specific organization
API key types
H0p supports two types of API keys:- User keys
- Bot keys
User keys are linked to your personal account:
- One key per user per organization
- Actions are attributed to you in audit logs
- Key is deleted if you leave the organization
- Inherits your user permissions
Permission model
API keys use a granular permission system. Each key can be granted specific permissions for different resources:Resources
| Resource | Description |
|---|---|
shortLinks | Create, read, update, delete short links |
domains | Manage custom domains |
stats | Access analytics data |
files | Upload and manage files (QR codes, images) |
apiKeys | Manage API keys (admin only) |
webhooks | Configure webhook endpoints |
Actions
Each resource supports these actions:create- Create new itemsread- View existing itemsupdate- Modify existing itemsdelete- Remove items
Example permissions
Role-based access control
Organization members have roles that determine their default permissions:| Role | Short Links | Domains | API Keys | Webhooks | Stats |
|---|---|---|---|---|---|
| Owner | Full | Full | Full | Full | Read |
| Admin | Full | Full | Full | Full | Read |
| Member | Full | Create, Read, Update | None | None | Read |
API keys can only have permissions equal to or less than the creating user’s role allows.
Integration options
H0p offers multiple ways to integrate with your systems:REST API
Our primary integration method. Full CRUD operations for all resources.- Base URL:
https://api.h0p.co - Authentication: API key in
x-api-keyheader - Format: JSON request/response
- Documentation: API Reference
Webhooks
Receive real-time notifications for events in your organization. Available events:link.created- New link createdlink.updated- Link modifiedlink.deleted- Link removedlink.clicked- Someone clicked a link
MCP Server
The Model Context Protocol (MCP) enables AI tools to interact with H0p directly. Supported tools:- Claude Desktop
- Claude Code (CLI)
- Cursor
- Windsurf
- ChatGPT (via custom actions)
Rate limiting
API requests are rate limited to ensure fair usage:| Limit | Value |
|---|---|
| Requests per second | 5 |
| Requests per minute | 100 |
429 Too Many Requests response with a Retry-After header.
Error handling
All API errors follow a consistent format:Common error codes
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Invalid or missing API key |
FORBIDDEN | 403 | Insufficient permissions |
NOT_FOUND | 404 | Resource doesn’t exist |
ALREADY_EXIST | 409 | Resource with that identifier exists |
PLAN_LIMIT_REACHED | 403 | Plan limit exceeded |
FEATURE_NOT_AVAILABLE | 403 | Premium feature on free plan |
VALIDATION_ERROR | 400 | Invalid request data |
Security best practices
Store keys securely
Store keys securely
Never commit API keys to version control. Use environment variables or a secrets manager.
Use minimal permissions
Use minimal permissions
Only grant the permissions your integration needs. A read-only integration shouldn’t have delete permissions.
Rotate keys regularly
Rotate keys regularly
Periodically create new keys and revoke old ones, especially after team changes.
Monitor usage
Monitor usage
Review your API usage and webhook delivery logs for unexpected activity.
Next steps
API Quickstart
Make your first API call and create a link programmatically.
Authentication
Learn how to create and manage API keys.
Webhooks
Set up real-time notifications for your integration.
MCP Integration
Connect H0p to your AI development tools.