Latitude HTTP API Documentation
This guide explains how to use the Latitude HTTP API to interact with the Prompt Manager and run AI-powered conversations.Authentication
All API requests require authentication. Include your API key in theAuthorization header of your HTTP requests:
Base URL
The base URL for API requests depends on your environment:https://gateway.latitude.so/api/v3
Rate Limiting
The API enforces rate limits based on your API key to ensure fair usage and prevent abuse. Limits: Rate limits are enforced based on your subscription plan. The following limits apply:-
Hobby Plan:
- 10 requests per second
-
Team Plan:
- 166 requests per second (10000 requests per minute)
-
Enterprise Plan:
- 500 requests per second (30000 requests per minute)
Retry-After: Indicates the number of seconds to wait before making a new request.X-RateLimit-Limit: The maximum number of requests allowed in the current period.X-RateLimit-Remaining: The number of requests remaining in the current period.X-RateLimit-Reset: The timestamp when the rate limit will reset.
Endpoints
1. Get a Document
Retrieve a specific prompt by its path. Endpoint:GET /projects/{projectId}/versions/{versionUuid}/documents/{path}
Path Parameters:
projectId: Your project ID (required)versionUuid: Version UUID (required, optional for SDK’s defaults to ‘live’)path: Path to the document (required)
2. Get or Create a Document
Endpoint:POST /projects/{projectId}/versions/{versionUuid}/documents/get-or-create
Path Parameters:
projectId: Your project ID (required)versionUuid: Version UUID (required, optional for SDK’s defaults to ‘live’)
path: Path to the document (required)prompt: Prompt to use for the document (optional, defaults to empty)
3. Create or Update a Document
Create a new document or update an existing one in a single operation. This endpoint provides more control thanget-or-create, including the ability to update live commits with the force flag.
Endpoint: POST /projects/{projectId}/versions/{versionUuid}/documents/create-or-update
Path Parameters:
projectId: Your project ID (required)versionUuid: Version UUID (required, optional for SDK’s defaults to ‘live’)
path: Path to the document (required)prompt: Content of the document (required)force: Allow modifications to live/merged commits (optional, defaults tofalse)
- If the document does not exist at the specified path, it will be created
- If the document already exists at the path, it will be updated with the new content
- By default, modifications are only allowed on draft commits (not live/merged)
- When
force: true, allows creating or updating documents in live commits (use with caution)
force flag, the API returns a 400 status code:
- Single API call for upsert operations: No need to check if a document exists before creating/updating
- Programmatic prompt updates: Update prompts from your CI/CD pipeline or automation scripts
- Emergency hotfixes: Use
force: trueto quickly fix production prompts when needed - Batch operations: Efficiently create or update multiple documents in a loop
4. Create a Version (Commit)
Create a new draft version (commit) for a project. Versions allow you to manage changes to your prompts before publishing them to production. Endpoint:POST /projects/{projectId}/versions
Path Parameters:
projectId: Your project ID (required)
name: Name/title for the new version (required)
- Create draft versions: Start working on prompt changes in isolation
- Version control: Track different iterations of your prompts
- CI/CD integration: Programmatically create versions from your deployment pipeline
5. Publish a Version (Commit)
Publish a draft version (commit) to make it the live/production version. This merges the draft changes and assigns it a version number. Endpoint:POST /projects/{projectId}/versions/{versionUuid}/publish
Path Parameters:
projectId: Your project ID (required)versionUuid: UUID of the draft version to publish (required)
title: Optional title for the published version (if not provided, uses existing title)description: Optional description or release notes for the published version
- Deploy to production: Publish tested prompt changes to make them live
- Release management: Track which version is currently in production
- Automated deployments: Publish versions from CI/CD pipelines after successful tests
6. Run a Document
Run a specific document (prompt) with optional parameters. Endpoint:POST /projects/{projectId}/versions/{versionUuid}/documents/run
Path Parameters:
projectId: Your project ID (required)versionUuid: Version UUID (required, optional for SDK’s defaults to ‘live’)
stream: Optional boolean parameter (defaults tofalse). When set to true, the response will be a stream of Server-Sent Events (SSE). If false, a single JSON response containing the last event is returned.background: Optional boolean parameter (defaults tofalse). When set to true, the request is enqueued for background processing and returns immediately with a conversation UUID.userMessage: Optional string to start the conversation with a user message.customIdentifier: Optional string for custom identification of the run.tools: Optional array of tool names to enable for this run.
- If
backgroundistrue: Returns immediately with a conversation UUID for background processing:
-
If
streamistrue: The response is a stream of Server-Sent Events (SSE). Check out the Streaming Events guide for more information about the specific events you can expect. -
If
streamisfalse: A single JSON response is returned with the final event (typically the chain-complete event) in the following structure:
Message follows the PromptL format.
ToolCall has the following format:
7. Chat
The previously describedPOST /projects/{projectId}/versions/{versionUuid}/documents/run endpoint can also be used to continue a conversation. Notice all events contain a uuid field that represents that conversation with the AI. You can use this uuid to continue the conversation.
Endpoint: POST /conversations/{conversationUuid}/chat
Path Parameters:
conversationUuid: UUID of the conversation
- Messages follow the PromptL format. If you’re using a different method to run your prompts, you’ll need to format your messages accordingly.
stream: Optional boolean parameter (defaults tofalse). When set to true, the response will be a stream of Server-Sent Events (SSE). If false, a single JSON response containing the last event is returned. Check out the Streaming Events guide for more information about the specific events you can expect.
Message follows the PromptL format.
8. Get a Conversation
Retrieve a conversation by its UUID. This endpoint returns the complete conversation history including all messages. Endpoint:GET /conversations/{conversationUuid}
Path Parameters:
conversationUuid: UUID of the conversation (required)
Message follows the PromptL format.
9. Stop a Conversation
Stop an active conversation that is currently running. Endpoint:POST /conversations/{conversationUuid}/stop
Path Parameters:
conversationUuid: UUID of the conversation
10. Attach to a Conversation
Attach to an active conversation to receive its ongoing output. Endpoint:POST /conversations/{conversationUuid}/attach
Path Parameters:
conversationUuid: UUID of the conversation
stream: Optional boolean parameter (defaults tofalse). When set to true, the response will be a stream of Server-Sent Events (SSE). If false, a single JSON response containing the final event is returned.
-
If
streamistrue: The response is a stream of Server-Sent Events (SSE). Check out the Streaming Events guide for more information about the specific events you can expect. -
If
streamisfalse: A single JSON response is returned with the final event in the following structure:
11. Annotate a Log
Add an annotation (evaluation score) to a log. Endpoint:POST /conversations/{conversationUuid}/evaluations/{evaluationUuid}/annotate
Path Parameters:
conversationUuid: UUID of the conversation to annotateevaluationUuid: UUID of the evaluation to use
12. Create Log Entry
Create a log entry for a document. Endpoint:POST /projects/{projectId}/versions/{versionUuid}/documents/logs
Path Parameters:
projectId: Your project ID (required)versionUuid: Version UUID (required, optional for SDK’s defaults to ‘live’)
- Messages follow the PromptL format. If you’re using a different method to run your prompts, you’ll need to format your messages accordingly.