An open API service indexing awesome lists of open source software.

https://github.com/sriganesh/atpi-at

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
https://github.com/sriganesh/atpi-at

atpi atproto atprotocol

Last synced: 8 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# ATPI

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

## Quick Start

```bash
# 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:

```bash
# 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

```bash
# 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:

```json
{
"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