All API endpoints, including this one, require an
x-api-key
header for authentication.
Refer to the Authentication section for more details.Endpoint
POST /experiment/:slug/log
Path Parameters
Name | Type | Description |
---|---|---|
slug | string | Required. The unique slug of the experiment. |
Request Body
The request body must be a JSON object containing details about the variant execution.variantKey
(string, required): The key of the variant that was executed (e.g., “A”, “B”). This should match a variant defined in the experiment.input
(object, optional): The input provided to the AI agent or prompt workflow for this execution.output
(object, optional): The output received from the AI agent or prompt workflow.metrics
(object, optional): Any quantitative metrics recorded for this execution (e.g., latency, token count, cost).context
(object, optional): An optional JSON object that can contain any contextual information relevant to this log entry (e.g., session information, environment).
Response Body
On successful logging, the server responds with a simple success message. Success (200 OK):success
(boolean): Indicates whether the log entry was successfully recorded.logId
(string): A unique identifier for the created log entry.
400 Bad Request
: If the request body is malformed orvariantKey
is missing.401 Unauthorized
: If thex-api-key
is missing or invalid.404 Not Found
: If no experiment with the givenslug
is found.500 Internal Server Error
: If there was an unexpected error during the logging process.