openapi: 3.0.1 info: title: Freeplay HTTP Agents Completions API description: The Freeplay HTTP API provides programmatic access to the Freeplay LLM experimentation, evaluation, and observability platform. It covers prompt template management, recording completions and sessions/traces, curating test cases and datasets, running batch test runs and evaluations, and recording customer and human feedback. The API root is your Freeplay instance URL plus /api/v2. For the standard cloud instance this is https://app.freeplay.ai/api/v2; private/self-hosted instances use a per-account subdomain such as https://{subdomain}.freeplay.ai/api/v2. termsOfService: https://freeplay.ai/terms contact: name: Freeplay Support url: https://docs.freeplay.ai/ version: v2 servers: - url: https://app.freeplay.ai/api/v2 description: Freeplay Cloud (standard instance) - url: https://{subdomain}.freeplay.ai/api/v2 description: Private / self-hosted instance (per-account subdomain) variables: subdomain: default: app description: Your Freeplay account subdomain. security: - bearerAuth: [] tags: - name: Completions description: Record completions and aggregate completion statistics. paths: /projects/{project_id}/sessions/{session_id}/completions: parameters: - $ref: '#/components/parameters/ProjectId' - $ref: '#/components/parameters/SessionId' post: operationId: recordCompletion tags: - Completions summary: Record an LLM completion to a session. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RecordCompletionRequest' responses: '200': description: The recorded completion. content: application/json: schema: $ref: '#/components/schemas/Completion' /projects/{project_id}/completions/statistics: parameters: - $ref: '#/components/parameters/ProjectId' post: operationId: getCompletionStatistics tags: - Completions summary: Aggregate evaluation statistics across completions. requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/StatisticsRequest' responses: '200': description: Aggregated completion statistics. content: application/json: schema: $ref: '#/components/schemas/Statistics' /projects/{project_id}/completions/statistics/{prompt_template_id}: parameters: - $ref: '#/components/parameters/ProjectId' - name: prompt_template_id in: path required: true schema: type: string format: uuid post: operationId: getCompletionStatisticsByTemplate tags: - Completions summary: Aggregate evaluation statistics for a specific prompt template. requestBody: required: false content: application/json: schema: $ref: '#/components/schemas/StatisticsRequest' responses: '200': description: Aggregated completion statistics for the prompt template. content: application/json: schema: $ref: '#/components/schemas/Statistics' components: parameters: ProjectId: name: project_id in: path required: true schema: type: string format: uuid description: The Freeplay project ID. SessionId: name: session_id in: path required: true schema: type: string format: uuid schemas: StatisticsRequest: type: object properties: environment: type: string start_time: type: string format: date-time end_time: type: string format: date-time Statistics: type: object properties: completion_count: type: integer evaluations: type: object additionalProperties: true RecordCompletionRequest: type: object required: - messages properties: messages: type: array items: $ref: '#/components/schemas/Message' inputs: type: object additionalProperties: true prompt_template_version_id: type: string format: uuid trace_id: type: string format: uuid start_time: type: string format: date-time end_time: type: string format: date-time model: type: string provider: type: string usage: $ref: '#/components/schemas/Usage' custom_metadata: type: object additionalProperties: true Usage: type: object properties: prompt_tokens: type: integer completion_tokens: type: integer total_tokens: type: integer Completion: type: object properties: completion_id: type: string format: uuid session_id: type: string format: uuid trace_id: type: string format: uuid messages: type: array items: $ref: '#/components/schemas/Message' model: type: string usage: $ref: '#/components/schemas/Usage' Message: type: object properties: role: type: string enum: - system - user - assistant - tool content: type: string securitySchemes: bearerAuth: type: http scheme: bearer description: Authenticate requests using your Freeplay API key as a Bearer token in the Authorization header. API keys are managed at https://app.freeplay.ai/settings/api-access.