Skip to main content

API Overview

PUNT provides a RESTful API for integrating with external tools and automating workflows.

Base URL

All API endpoints are relative to your PUNT instance:

https://your-punt-instance.com/api

For local development:

http://localhost:3000/api

Authentication

Most API endpoints require authentication. PUNT uses session-based authentication with cookies.

Getting a Session

  1. Make a POST request to /api/auth/callback/credentials with your username and password
  2. The response will set a session cookie
  3. Include this cookie in subsequent requests

See Authentication API for detailed examples.

Request Format

Headers

Content-Type: application/json
Cookie: next-auth.session-token=<your-session-token>

Body

Request bodies should be JSON-encoded:

{
"title": "My new ticket",
"type": "Task",
"priority": "Medium"
}

Response Format

Success Response

{
"id": "abc123",
"title": "My new ticket",
"type": "Task",
"priority": "Medium",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}

Error Response

{
"error": "Validation failed",
"details": [
{
"field": "title",
"message": "Title is required"
}
]
}

HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request - Invalid input
401Unauthorized - Authentication required
403Forbidden - Insufficient permissions
404Not Found - Resource doesn't exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Rate Limiting

API endpoints are rate-limited to prevent abuse:

EndpointLimit
Login10 requests per 15 minutes
Registration5 requests per hour
Password Change5 requests per 15 minutes
General APIVaries by endpoint

Rate limit information is included in response headers:

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 8
X-RateLimit-Reset: 1705312800

Real-time Events

PUNT provides Server-Sent Events (SSE) endpoints for real-time updates:

  • /api/projects/[projectId]/events - Project events (tickets, labels)
  • /api/projects/events - Project list events
  • /api/users/events - User profile events

See Real-time Events API for detailed SSE documentation.

API Sections