Skip to main content

Introduction

The Polaris API provides programmatic access to AI-powered code editing features. All endpoints require authentication and use JSON for request and response payloads.

Base URL

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

Authentication

Polaris uses Clerk for authentication. All API requests must include a valid session token.

Authentication Flow

  1. User authenticates through Clerk
  2. Clerk session token is automatically included in requests
  3. API validates the session and extracts userId
  4. Request is processed for the authenticated user

Authentication Errors

If authentication fails, you’ll receive one of these error responses:
{
  "error": "Unauthorized"
}

Request Format

All POST requests should include:
  • Content-Type: application/json
  • Authentication: Valid Clerk session token (handled by Clerk SDK)

Response Format

All responses are returned as JSON with appropriate HTTP status codes:
  • 200 - Success
  • 400 - Bad Request (validation error)
  • 401 - Unauthorized (missing authentication)
  • 403 - Forbidden (invalid authentication)
  • 404 - Not Found (resource doesn’t exist)
  • 500 - Internal Server Error

Rate Limiting

Rate limiting is enforced per user session. Contact your administrator for specific limits.

Available Endpoints

AI Features

Messages

Send messages to AI assistant and trigger code generation

Cancel Messages

Cancel in-progress AI message processing

Suggestions

Get AI-powered code completions at cursor position

Quick Edit

Edit selected code using natural language instructions

Projects

Create with AI

Create a new project from a natural language prompt

GitHub Integration

Import Repository

Import a GitHub repository into Polaris

Export to GitHub

Export a Polaris project to a new GitHub repository

Error Handling

All endpoints follow a consistent error response format:
{
  "error": "Error message description"
}
Always check the HTTP status code to determine the type of error and handle accordingly in your application.

Build docs developers (and LLMs) love