Skip to content

A lightweight JSON API service that provides direct access to AT Protocol data by prefixing atpi. to any AT Protocol URI. https://docs.atpi.at

License

Notifications You must be signed in to change notification settings

sriganesh/atpi-at

Repository files navigation

ATPI

A lightweight JSON API service that provides direct access to AT Protocol data by prefixing atpi. to any AT Protocol URI.

Quick Start

# Get user profile
curl "https://atpi.at://sri.xyz"

# Get specific post
curl "https://atpi.at://sriganesh.bsky.social/app.bsky.feed.post/3lry27bsx2s2z"

# Get all posts
curl "https://atpi.at://sri.xyz/app.bsky.feed.post"

Features

  • Direct JSON access to AT Protocol data
  • Multiple URL format support
  • Automatic handle and DID resolution
  • CORS support for web applications

URL Formats

The API supports multiple URL formats for flexibility:

# Direct AT URI
https://atpi.at://sri.xyz/app.bsky.feed.post

# Query parameter (browser-friendly)
https://atpi.at?uri=at://sri.xyz/app.bsky.feed.post

# Slash format
https://atpi.at/sri.xyz/app.bsky.feed.post

Usage Examples

cURL with jq

# Get profile and format with jq
curl -s "https://atpi.at://sri.xyz" | jq '.displayName'

# Get recent posts
curl -s "https://atpi.at://sri.xyz/app.bsky.feed.post?limit=5" | \
  jq '.records[].value.text'

API Reference

Endpoints

  • Profile: https://atpi.at://[handle-or-did]
  • Collection: https://atpi.at://[handle-or-did]/[collection]
  • Record: https://atpi.at://[handle-or-did]/[collection]/[rkey]

Query Parameters

  • limit - Number of records to return (max 100, default 50)
  • cursor - Pagination cursor from previous response

Note: Query parameters only work with API clients (curl, code), not browsers.

Response Format

The API returns raw AT Protocol data without any wrapper.

Rate Limiting

All responses include rate limit headers:

  • X-RateLimit-Limit - Requests allowed per window
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - Window reset timestamp

Error Handling

Errors return structured JSON with helpful debugging information:

{
  "error": {
    "code": "HANDLE_NOT_FOUND",
    "message": "Handle could not be resolved to a DID",
    "details": { "handle": "unknown.handle" }
  },
  "status": 404,
  "requestId": "abc123",
  "timestamp": "2025-07-15T10:30:00.000Z"
}

Browser Usage

When accessed from a browser, ATPI automatically redirects to a query parameter format for better compatibility:

  • Request: https://atpi.at://sri.xyz
  • Redirects to: https://atpi.at?uri=at://sri.xyz

License

MIT License - see LICENSE file for details

About

A lightweight JSON API service that provides direct access to AT Protocol data by prefixing atpi. to any AT Protocol URI. https://docs.atpi.at

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published