{"openapi":"3.0.0","info":{"title":"Lunary API","version":"1.0.0"},"servers":[{"url":"https://api.lunary.ai"}],"components":{"securitySchemes":{"AccountSessionAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Human account session; project and organization API keys are rejected."},"ProjectPublicApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"UUID","description":"Use a project public API key via `Authorization: Bearer <key>`."},"ProjectPrivateApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"UUID","description":"Use a project private API key via `Authorization: Bearer <key>`."},"OrgApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"UUID","description":"Use an organization API key via `Authorization: Bearer <key>`."}},"schemas":{"Checklist":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"type":{"type":"string"},"data":{"type":"object","description":"The checklist data"},"projectId":{"type":"string","format":"uuid"},"ownerId":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ChecklistInput":{"type":"object","required":["slug","type","data"],"properties":{"slug":{"type":"string","description":"Unique identifier for the checklist within the project"},"type":{"type":"string","description":"The type of checklist"},"data":{"type":"array","description":"The checklist data"}}},"ChecklistUpdateInput":{"type":"object","properties":{"slug":{"type":"string","description":"Updated slug for the checklist"},"data":{"type":"object","description":"Updated checklist data"}}},"DatasetV2":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"projectId":{"type":"string","format":"uuid"},"ownerId":{"type":"string","format":"uuid","nullable":true},"ownerName":{"type":"string","nullable":true},"ownerEmail":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"itemCount":{"type":"integer"},"currentVersionId":{"type":"string","format":"uuid","nullable":true},"currentVersionNumber":{"type":"integer"},"currentVersionCreatedAt":{"type":"string","format":"date-time","nullable":true},"currentVersionCreatedBy":{"type":"string","format":"uuid","nullable":true},"currentVersionRestoredFromVersionId":{"type":"string","format":"uuid","nullable":true},"evaluatorSlot1Id":{"type":"string","format":"uuid","nullable":true},"evaluatorSlot2Id":{"type":"string","format":"uuid","nullable":true},"evaluatorSlot3Id":{"type":"string","format":"uuid","nullable":true},"evaluatorSlot4Id":{"type":"string","format":"uuid","nullable":true},"evaluatorSlot5Id":{"type":"string","format":"uuid","nullable":true}}},"DatasetV2Input":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["name"]},"DatasetV2WithItems":{"allOf":[{"$ref":"#/components/schemas/DatasetV2"},{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DatasetV2Item"}}}}]},"DatasetV2Item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"datasetId":{"type":"string","format":"uuid"},"input":{"type":"string"},"groundTruth":{"type":"string","nullable":true},"output":{"type":"string","nullable":true},"evaluatorResult1":{"type":"object","nullable":true},"evaluatorResult2":{"type":"object","nullable":true},"evaluatorResult3":{"type":"object","nullable":true},"evaluatorResult4":{"type":"object","nullable":true},"evaluatorResult5":{"type":"object","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"DatasetV2ItemInput":{"type":"object","properties":{"input":{"type":"string"},"groundTruth":{"type":"string","nullable":true},"output":{"type":"string","nullable":true}}},"DatasetV2ImportRequest":{"type":"object","properties":{"format":{"type":"string","enum":["csv","jsonl"]},"content":{"type":"string"}},"required":["format","content"]},"DatasetV2Version":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"datasetId":{"type":"string","format":"uuid"},"versionNumber":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","format":"uuid","nullable":true},"restoredFromVersionId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"itemCount":{"type":"integer"}}},"DatasetV2VersionItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"versionId":{"type":"string","format":"uuid"},"datasetId":{"type":"string","format":"uuid"},"itemIndex":{"type":"integer"},"input":{"type":"string"},"groundTruth":{"type":"string","nullable":true},"output":{"type":"string","nullable":true},"sourceItemId":{"type":"string","format":"uuid","nullable":true},"sourceCreatedAt":{"type":"string","format":"date-time","nullable":true},"sourceUpdatedAt":{"type":"string","format":"date-time","nullable":true}}},"Dataset":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"format":{"type":"string","enum":["text","chat"]},"ownerId":{"type":"string"},"projectId":{"type":"string"}}},"DatasetPrompt":{"type":"object","properties":{"id":{"type":"string"},"datasetId":{"type":"string"},"messages":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},{"type":"string"}]}}},"DatasetPromptVariation":{"type":"object","properties":{"id":{"type":"string"},"promptId":{"type":"string"},"variables":{"type":"object"},"idealOutput":{"type":"string"}}},"User":{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"externalId":{"type":"string"},"lastSeen":{"type":"string","format":"date-time"},"props":{"type":"object"},"cost":{"type":"number"}}},"Model":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"pattern":{"type":"string"},"unit":{"type":"string","enum":["TOKENS","CHARACTERS","MILLISECONDS"]},"inputCost":{"type":"number"},"outputCost":{"type":"number"},"tokenizer":{"type":"string"},"startDate":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ModelInput":{"type":"object","required":["name","pattern","unit","inputCost","outputCost"],"properties":{"name":{"type":"string"},"pattern":{"type":"string"},"unit":{"type":"string","enum":["TOKENS","CHARACTERS","MILLISECONDS"]},"inputCost":{"type":"number"},"outputCost":{"type":"number"},"tokenizer":{"type":"string"},"startDate":{"type":"string","format":"date-time"}}},"Run":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"isPublic":{"type":"boolean"},"feedback":{"$ref":"#/components/schemas/Feedback"},"parentFeedback":{"$ref":"#/components/schemas/Feedback"},"type":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time"},"duration":{"type":"number"},"templateVersionId":{"type":"string"},"templateSlug":{"type":"string"},"cost":{"type":"number"},"tokens":{"type":"object","properties":{"completion":{"type":"number"},"prompt":{"type":"number"},"total":{"type":"number"}}},"tags":{"type":"array","items":{"type":"string"}},"input":{"type":"object"},"output":{"type":"object"},"error":{"type":"object"},"status":{"type":"string"},"siblingRunId":{"type":"string"},"params":{"type":"object"},"metadata":{"type":"object"},"firstMessage":{"type":"object","description":"First message captured in the conversation thread, when available."},"messagesCount":{"type":"integer","description":"Total number of messages within the conversation thread."},"user":{"type":"object","properties":{"id":{"type":"string"},"externalId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastSeen":{"type":"string","format":"date-time"},"props":{"type":"object"}}}}},"RunDetail":{"allOf":[{"$ref":"#/components/schemas/Run"},{"type":"object","required":["traceId"],"properties":{"traceId":{"type":"string","nullable":true,"description":"Root run ID for a complete same-project ancestry chain; otherwise null."}}}]},"Feedback":{"type":"object","properties":{"thumb":{"type":"string","enum":["up","down"]},"comment":{"type":"string"}}},"Event":{"type":"object","description":"Represents an event in the Lunary API for tracking model calls and related operations.","properties":{"type":{"type":"string","enum":["llm","chain","agent","tool","log","embed","retriever","chat","convo","message","thread"],"description":"The type of event being reported."},"event":{"type":"string","description":"The specific event name (e.g., \"start\" or \"end\")."},"level":{"type":"string","description":"The logging level of the event."},"runId":{"type":"string","description":"A unique identifier for the run."},"parentRunId":{"type":"string","description":"The ID of the parent run, if applicable."},"timestamp":{"type":"string","format":"date-time","description":"The time the event occurred."},"input":{"type":"object","description":"The input data for the event, typically in OpenAI chat message format."},"tags":{"type":"array","items":{"type":"string"},"description":"Tags associated with the event."},"name":{"type":"string","description":"The name of the event or model."},"output":{"type":"object","description":"The output data from the event, typically in OpenAI chat message format."},"message":{"oneOf":[{"type":"string"},{"type":"object"}],"description":"A message associated with the event."},"extra":{"type":"object","description":"Additional data such as temperature, max_tokens, tools, etc."},"feedback":{"type":"object","description":"Feedback data for the event."},"templateId":{"type":"string","description":"The ID of the template used, if applicable."},"templateVersionId":{"type":"string","description":"The version ID of the template used, if applicable."},"metadata":{"type":"object","description":"Additional metadata for the event."},"tokensUsage":{"type":"object","properties":{"prompt":{"type":"number","description":"The number of tokens used in the prompt."},"completion":{"type":"number","description":"The number of tokens used in the completion."}}},"error":{"type":"object","properties":{"message":{"type":"string","description":"The error message, if an error occurred."},"stack":{"type":"string","description":"The error stack trace, if available."}}},"appId":{"type":"string","description":"The ID of the application or project."}},"additionalProperties":true,"example":{"type":"llm","event":"start","runId":"some-unique-id","name":"gpt-4","timestamp":"2022-01-01T00:00:00Z","input":[{"role":"user","content":"Hello world!"}],"tags":["tag1"],"extra":{"temperature":0.5,"max_tokens":100}}},"IngestResponse":{"type":"object","description":"The response from the ingestion API.","properties":{"results":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the ingested event."},"success":{"type":"boolean","description":"Indicates if the ingestion was successful."},"error":{"type":"string","description":"Error message if the ingestion failed."}}}}},"example":{"results":[{"id":"some-unique-id","success":true}]}},"PromptMetadata":{"type":"object","default":{},"maxProperties":100,"additionalProperties":{"type":"string"},"description":"Versioned key/value text, separate from model parameters and prompt variables.\nKeys are preserved exactly, must not be blank, and are limited to 256 characters.\nThe reserved key __proto__ is not allowed.\nValues must be strings. Numbers, booleans, null, arrays, and objects are rejected.\nThe serialized object must be no larger than 64 KiB. Returned by prompt retrieval\nendpoints, including public-key retrieval; do not store secrets here.\nOmitted metadata defaults to an empty object on creation and is preserved on PATCH.\n","example":{"owner":"support","release_channel":"production","locale":"en"}},"TemplateVersion":{"type":"object","properties":{"id":{"type":"string"},"templateId":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"metadata":{"$ref":"#/components/schemas/PromptMetadata"},"extra":{"type":"object"},"testValues":{"type":"object"},"isDraft":{"type":"boolean"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"version":{"type":"number"}}},"Template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"mode":{"type":"string","enum":["text","openai"]},"createdAt":{"type":"string","format":"date-time"},"group":{"type":"string"},"projectId":{"type":"string"},"versions":{"type":"array","items":{"$ref":"#/components/schemas/TemplateVersion"}}}},"TemplateInput":{"type":"object","required":["slug","mode","content"],"properties":{"slug":{"type":"string"},"mode":{"type":"string","enum":["text","openai"]},"content":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"metadata":{"$ref":"#/components/schemas/PromptMetadata"},"extra":{"type":"object"},"testValues":{"type":"object"},"isDraft":{"type":"boolean"},"notes":{"type":"string"}}},"TemplateUpdateInput":{"type":"object","properties":{"slug":{"type":"string"},"mode":{"type":"string","enum":["text","openai"]}}},"TemplateVersionInput":{"type":"object","required":["content","isDraft"],"properties":{"content":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"metadata":{"$ref":"#/components/schemas/PromptMetadata"},"extra":{"type":"object"},"testValues":{"type":"object"},"isDraft":{"type":"boolean"},"notes":{"type":"string"}}},"TemplateVersionUpdateInput":{"type":"object","properties":{"content":{"oneOf":[{"type":"array"},{"type":"string"}]},"metadata":{"$ref":"#/components/schemas/PromptMetadata"},"extra":{"type":"object"},"testValues":{"type":"object"},"isDraft":{"type":"boolean"},"notes":{"type":"string"}}},"View":{"type":"object","properties":{"id":{"type":"string","example":"1234abcd"},"name":{"type":"string","example":"LLM Conversations"},"data":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"id":{"type":"string"},"params":{"type":"object"}}}]},"example":["AND",{"id":"models","params":{"models":["gpt-4"]}}]},"columns":{"type":"object"},"icon":{"type":"string","example":"chat"},"type":{"type":"string","enum":["llm","thread","trace"],"example":"llm"},"projectId":{"type":"string","example":"project123"},"ownerId":{"type":"string","example":"user456"},"updatedAt":{"type":"string","format":"date-time","example":"2023-04-01T12:00:00Z"}}},"ViewInput":{"type":"object","required":["name","data","type"],"properties":{"name":{"type":"string","example":"New LLM View"},"data":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"id":{"type":"string"},"params":{"type":"object"}}}]},"example":["AND",{"id":"models","params":{"models":["gpt-4"]}}]},"columns":{"type":"object","example":{"id":"ID","content":"Content","date":"Date"}},"icon":{"type":"string","example":"chart"},"type":{"type":"string","enum":["llm","thread","trace"],"example":"llm"}}},"ViewUpdateInput":{"type":"object","properties":{"name":{"type":"string","example":"Updated LLM View"},"data":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"id":{"type":"string"},"params":{"type":"object"}}}]},"example":["AND",{"id":"models","params":{"models":["gpt-4","gpt-3.5-turbo"]}}]},"columns":{"type":"object","example":{"id":"ID","content":"Content","date":"Date","user":"User"}},"icon":{"type":"string","example":"user"}}}}},"paths":{"/v1/analytics/org/models/top":{"get":{"summary":"List top models across an organization","description":"Returns the top models used across every project in the authenticated organization.\nThis endpoint requires an org-level private API key supplied as a bearer token in the `Authorization` header.\n","tags":["Analytics"],"parameters":[{"in":"query","name":"startDate","description":"ISO8601 timestamp (inclusive) that bounds the analytics window. Requires `endDate` and `timeZone` when provided.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"endDate","description":"ISO8601 timestamp (exclusive) that bounds the analytics window. Requires `startDate` and `timeZone` when provided.","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"timeZone","description":"IANA time zone identifier used to localize the date range filters.","schema":{"type":"string"}}],"security":[{"OrgApiKeyAuth":[]}],"responses":{"200":{"description":"Top models across the organization.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Model name."},"type":{"type":"string","enum":["llm","embed"]},"promptTokens":{"type":"integer"},"completionTokens":{"type":"integer"},"totalTokens":{"type":"integer"},"cost":{"type":"number"},"projectName":{"type":"string","nullable":true,"description":"Project contributing the most traffic for the model."}}}}}}},"401":{"description":"Missing or invalid org API key supplied via the Authorization header."}}}},"/v1/announcements":{"get":{"summary":"List the signed-in account's available product updates","tags":["Announcements"],"security":[{"AccountSessionAuth":[]}],"responses":{"200":{"description":"Bundled release history and pending announcement IDs, newest first. New accounts baseline available history on first read."},"401":{"description":"A human account session is required."}}}},"/v1/announcements/acknowledge":{"post":{"summary":"Acknowledge a displayed digest's pending backlog for this account","tags":["Announcements"],"security":[{"AccountSessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"string","minLength":1,"maxLength":120}}}}}}},"responses":{"200":{"description":"Idempotently acknowledged the supplied available announcements."},"400":{"description":"Unknown or unavailable announcement ID."},"401":{"description":"A human account session is required."},"422":{"description":"Invalid request body."}}}},"/v1/announcements/seen":{"post":{"summary":"Mark visible announcement cards seen and acknowledged for this account","tags":["Announcements"],"security":[{"AccountSessionAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"string","minLength":1,"maxLength":120}}}}}}},"responses":{"200":{"description":"Idempotently marked the supplied visible announcements seen."},"400":{"description":"Unknown or unavailable announcement ID."},"401":{"description":"A human account session is required."},"422":{"description":"Invalid request body."}}}},"/v1/audit-logs":{"get":{"summary":"Retrieve audit logs","security":[{"ProjectPrivateApiKeyAuth":[]}],"tags":["Audit Logs"],"description":"Retrieve a list of audit logs for the current organization. Note that this functionality is still under development and the audits logs are not fully exhaustive.","parameters":[{"in":"query","name":"limit","description":"Number of audit logs to retrieve","schema":{"type":"number","default":30}},{"in":"query","name":"page","description":"Page number for pagination","schema":{"type":"number","default":0}}],"responses":{"200":{"description":"A list of audit logs","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"403":{"description":"Forbidden - user doesn't have access to this resource"}}}},"/v1/checklists":{"get":{"summary":"List all checklists","security":[{"ProjectPrivateApiKeyAuth":[]}],"description":"Retrieve all checklists for the current project.\nOptionally filter by type. Returns checklists ordered by most recently updated.\n","tags":["Checklists"],"parameters":[{"in":"query","name":"type","required":false,"schema":{"type":"string"},"description":"The type of checklists to retrieve (optional)"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Checklist"}}}}}}},"post":{"summary":"Create a new checklist","description":"Creates a new checklist with the provided slug, type, and data.\n","tags":["Checklists"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChecklistInput"},"example":{"slug":"pre-deployment-checklist","type":"deployment","data":{"items":[{"name":"Run tests","completed":false},{"name":"Update documentation","completed":false}]}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checklist"}}}},"400":{"description":"Invalid input"}}}},"/v1/checklists/{id}":{"get":{"summary":"Get a specific checklist","description":"Retrieve a specific checklist by its ID.\n","security":[{"ProjectPrivateApiKeyAuth":[]}],"tags":["Checklists"],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"},"description":"The ID of the checklist to retrieve"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checklist"}}}},"404":{"description":"Checklist not found"}}},"patch":{"summary":"Update a checklist","description":"Update an existing checklist's slug and/or data.\n","tags":["Checklists"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"},"description":"The ID of the checklist to update"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChecklistUpdateInput"},"example":{"slug":"updated-checklist-slug","data":{"items":[{"name":"Run tests","completed":true},{"name":"Update documentation","completed":true},{"name":"Deploy to production","completed":false}]}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checklist"}}}},"400":{"description":"Invalid input"},"404":{"description":"Checklist not found"}}},"delete":{"summary":"Delete a checklist","description":"Delete a specific checklist by its ID.\n","tags":["Checklists"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"},"description":"The ID of the checklist to delete"}],"responses":{"200":{"description":"Successful deletion"},"404":{"description":"Checklist not found"}}}},"/v1/datasets-v2":{"get":{"summary":"List datasets v2","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"responses":{"200":{"description":"List of datasets v2","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DatasetV2"}}}}}}},"post":{"summary":"Create dataset v2","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2Input"}}}},"responses":{"201":{"description":"Created dataset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2"}}}}}}},"/v1/datasets-v2/{datasetId}":{"get":{"summary":"Get dataset v2","tags":["Datasets v2"],"security":[{"ProjectPublicApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Dataset with items","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2WithItems"}}}}}},"patch":{"summary":"Update dataset v2","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2Input"}}}},"responses":{"200":{"description":"Updated dataset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2"}}}}}},"delete":{"summary":"Delete dataset v2","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Dataset deleted"}}}},"/v1/datasets-v2/{datasetId}/evaluators":{"post":{"summary":"Attach an evaluator to a dataset","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"evaluatorId":{"type":"string","format":"uuid"}},"required":["evaluatorId"]}}}},"responses":{"200":{"description":"Updated dataset including evaluator slots","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2WithItems"}}}}}}},"/v1/datasets-v2/{datasetId}/evaluators/{slot}":{"delete":{"summary":"Detach an evaluator from a dataset","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"slot","required":true,"schema":{"type":"integer","minimum":1,"maximum":5}}],"responses":{"200":{"description":"Updated dataset with evaluator column removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2WithItems"}}}}}}},"/v1/datasets-v2/{datasetId}/evaluators/run":{"post":{"summary":"Run all evaluators attached to a dataset on every item","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Evaluator results updated","content":{"application/json":{"schema":{"type":"object","properties":{"updatedItemCount":{"type":"integer"},"dataset":{"$ref":"#/components/schemas/DatasetV2WithItems"}}}}}}}}},"/v1/datasets-v2/{datasetId}/import":{"post":{"summary":"Import dataset items from CSV or JSONL","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2ImportRequest"}}}},"responses":{"200":{"description":"Number of imported items","content":{"application/json":{"schema":{"type":"object","properties":{"insertedCount":{"type":"integer"}}}}}}}}},"/v1/datasets-v2/{datasetId}/duplicate":{"post":{"summary":"Duplicate dataset v2","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Duplicated dataset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2"}}}}}}},"/v1/datasets-v2/{datasetId}/versions":{"get":{"summary":"List dataset versions","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"limit","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Dataset versions","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"$ref":"#/components/schemas/DatasetV2Version"}}}}}}}}},"post":{"summary":"Create dataset version snapshot","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"Created dataset version","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"$ref":"#/components/schemas/DatasetV2Version"},"dataset":{"$ref":"#/components/schemas/DatasetV2"}}}}}}}}},"/v1/datasets-v2/{datasetId}/versions/{versionId}":{"get":{"summary":"Get dataset version","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"versionId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Dataset version with items","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"$ref":"#/components/schemas/DatasetV2Version"},"items":{"type":"array","items":{"$ref":"#/components/schemas/DatasetV2VersionItem"}}}}}}}}}},"/v1/datasets-v2/{datasetId}/versions/{versionId}/restore":{"post":{"summary":"Restore dataset to a previous version","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"versionId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Restored dataset with current items","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2WithItems"}}}}}}},"/v1/datasets-v2/{datasetId}/items/{itemId}/generate":{"post":{"summary":"Generate dataset item output","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"itemId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string"},"instructions":{"type":"string"}}}}}},"responses":{"200":{"description":"Generated output for the dataset item","content":{"application/json":{"schema":{"type":"object","properties":{"output":{"type":"string"}}}}}}}}},"/v1/datasets-v2/{datasetId}/items":{"get":{"summary":"List dataset v2 items","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Dataset items","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DatasetV2Item"}}}}}}},"post":{"summary":"Create dataset v2 item","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2ItemInput"}}}},"responses":{"201":{"description":"Created item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2Item"}}}}}}},"/v1/datasets-v2/{datasetId}/items/{itemId}":{"get":{"summary":"Get dataset v2 item","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"itemId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Dataset item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2Item"}}}}}},"patch":{"summary":"Update dataset v2 item","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"itemId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2ItemInput"}}}},"responses":{"200":{"description":"Updated dataset item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetV2Item"}}}}}},"delete":{"summary":"Delete dataset v2 item","tags":["Datasets v2"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"datasetId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"itemId","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Dataset item deleted"}}}},"/v1/datasets":{"get":{"summary":"List datasets","tags":["Datasets"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"responses":{"200":{"description":"List of datasets","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Dataset"}}}}}}},"post":{"summary":"Create a new dataset","tags":["Datasets"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"slug":{"type":"string"},"format":{"type":"string","enum":["text"]},"prompt":{"type":"string","nullable":true},"withPromptVariation":{"type":"boolean","default":true}},"required":["slug","format"]},{"type":"object","properties":{"slug":{"type":"string"},"format":{"type":"string","enum":["chat"]},"prompt":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}},"required":["role","content"]}},{"type":"string"}],"nullable":true},"withPromptVariation":{"type":"boolean","default":true}},"required":["slug","format"]}]}}}},"responses":{"200":{"description":"Created dataset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dataset"}}}}}}},"/v1/datasets/{identifier}":{"get":{"summary":"Get dataset by ID or slug","tags":["Datasets"],"security":[{"ProjectPublicApiKeyAuth":[]}],"parameters":[{"in":"path","name":"identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Dataset details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dataset"}}}}}}},"/v1/datasets/{id}":{"patch":{"summary":"Update a dataset","tags":["Datasets"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated dataset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dataset"}}}}}},"delete":{"summary":"Delete a dataset","tags":["Datasets"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Dataset deleted successfully"}}}},"/v1/datasets/prompts":{"post":{"summary":"Create a new prompt","tags":["Datasets","Prompts"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"datasetId":{"type":"string"},"messages":{"type":"string","nullable":true},"idealOutput":{"type":"string"},"withPromptVariation":{"type":"boolean","default":true}},"required":["datasetId"]},{"type":"object","properties":{"datasetId":{"type":"string"},"messages":{"type":"array","nullable":true,"items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}},"required":["role","content"]}},"idealOutput":{"type":"string"},"withPromptVariation":{"type":"boolean","default":true}},"required":["datasetId"]}]}}}},"responses":{"200":{"description":"Created prompt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetPrompt"}}}}}}},"/v1/datasets/prompts/{id}":{"get":{"summary":"Get prompt by ID","tags":["Datasets","Prompts"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Prompt details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetPrompt"}}}}}},"delete":{"summary":"Delete a prompt","tags":["Datasets","Prompts"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Prompt deleted successfully"}}},"patch":{"summary":"Update a prompt","tags":["Datasets","Prompts"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},{"type":"string"}]}}}}}},"responses":{"200":{"description":"Updated prompt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetPrompt"}}}}}}},"/v1/datasets/variations/{id}":{"get":{"summary":"Get prompt variation by ID","tags":["Datasets","Prompts","Variations"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Prompt variation details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetPromptVariation"}}}}}},"delete":{"summary":"Delete a prompt variation","tags":["Datasets","Prompts","Variations"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Prompt variation deleted successfully"}}}},"/v1/datasets/variations/{variationId}":{"patch":{"summary":"Update a prompt variation","tags":["Datasets","Prompts","Variations"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"variationId","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"variables":{"type":"object"},"idealOutput":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated prompt variation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetPromptVariation"}}}}}}},"/v1/datasets/variations":{"post":{"summary":"Create a new prompt variation","tags":["Datasets","Prompts","Variations"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"promptId":{"type":"string"},"variables":{"type":"object"},"idealOutput":{"type":"string"}}}}}},"responses":{"200":{"description":"Created prompt variation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetPromptVariation"}}}}}}},"/v1/evals":{"get":{"summary":"List evaluations","tags":["Evals"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"responses":{"200":{"description":"List of evaluations"}}},"post":{"summary":"Create a new evaluation","tags":["Evals"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"datasetId":{"type":"string"},"description":{"type":"string"}},"required":["name","datasetId"]}}}},"responses":{"200":{"description":"Created evaluation"}}}},"/v1/evals/{id}":{"get":{"summary":"Get evaluation by ID","tags":["Evals"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Evaluation details"}}},"patch":{"summary":"Update an evaluation","tags":["Evals"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated evaluation"}}},"delete":{"summary":"Delete an evaluation","tags":["Evals"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Evaluation deleted successfully"}}}},"/v1/evals/{id}/run":{"post":{"summary":"Run the evaluation","tags":["Evals"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"}}}},"/v1/evals/criteria":{"post":{"summary":"Create a criterion","tags":["Evals","Criteria"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"evalId":{"type":"string"},"name":{"type":"string"},"metric":{"type":"string"},"threshold":{"type":"number","nullable":true},"weighting":{"type":"number"},"parameters":{"type":"object"}},"required":["evalId","name","metric"]}}}},"responses":{"200":{"description":"Created criterion"}}}},"/v1/evals/criteria/{id}":{"get":{"summary":"Get criterion by ID","tags":["Evals","Criteria"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Criterion details"}}},"patch":{"summary":"Update a criterion","tags":["Evals","Criteria"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"metric":{"type":"string"},"threshold":{"type":"number","nullable":true},"weighting":{"type":"number"},"parameters":{"type":"object"}}}}}},"responses":{"200":{"description":"Updated criterion"}}},"delete":{"summary":"Delete a criterion","tags":["Evals","Criteria"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Criterion deleted successfully"}}}},"/v1/evals/{evalId}/results":{"get":{"summary":"List results for an evaluation","tags":["Evals","Results"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"evalId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List of results"}}}},"/v1/evals/results/{id}":{"get":{"summary":"Get a single result","tags":["Evals","Results"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Result details"}}}},"/v1/external-users":{"get":{"summary":"List project users","description":"This endpoint retrieves a list of users tracked within the project.\nIt supports pagination, filtering, and sorting options.\n","tags":["Users"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"query","name":"limit","schema":{"type":"integer","default":100}},{"in":"query","name":"page","schema":{"type":"integer","default":0}},{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"startDate","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"endDate","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"timeZone","schema":{"type":"string"}},{"in":"query","name":"sortField","schema":{"type":"string","default":"createdAt"}},{"in":"query","name":"sortDirection","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}},{"in":"query","name":"checks","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}}}}}}},"/v1/external-users/{id}":{"get":{"summary":"Get a specific user","tags":["Users"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}}}},"delete":{"summary":"Delete a specific user","tags":["Users"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successful deletion"}}}},"/v1/models":{"get":{"summary":"List models","tags":["Models"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}},"post":{"summary":"Create a new model","tags":["Models"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelInput"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model"}}}}}}},"/v1/models/{id}":{"patch":{"summary":"Update a model","tags":["Models"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelInput"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model"}}}}}},"delete":{"summary":"Delete a model","tags":["Models"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful deletion"}}}},"/v1/playground-endpoints":{"get":{"summary":"List all playground endpoints","description":"Get all playground endpoints for the current project","tags":["Playground Endpoints"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaygroundEndpoint"}}}}}}},"post":{"summary":"Create a playground endpoint","description":"Create a new playground endpoint","tags":["Playground Endpoints"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePlaygroundEndpoint"}}}},"responses":{"201":{"description":"Endpoint created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaygroundEndpoint"}}}}}}},"/v1/playground-endpoints/{id}":{"get":{"summary":"Get a playground endpoint","description":"Get a specific playground endpoint by ID","tags":["Playground Endpoints"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaygroundEndpoint"}}}},"404":{"description":"Endpoint not found"}}},"put":{"summary":"Update a playground endpoint","description":"Update an existing playground endpoint","tags":["Playground Endpoints"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePlaygroundEndpoint"}}}},"responses":{"200":{"description":"Endpoint updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaygroundEndpoint"}}}},"404":{"description":"Endpoint not found"}}},"delete":{"summary":"Delete a playground endpoint","description":"Delete a playground endpoint","tags":["Playground Endpoints"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Endpoint deleted successfully"},"404":{"description":"Endpoint not found"}}}},"/v1/projects/{projectId}/pin":{"patch":{"summary":"Pin or unpin a project for the signed-in account","tags":["Projects"],"security":[{"AccountSessionAuth":[]}],"parameters":[{"in":"path","name":"projectId","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["pinned"],"properties":{"pinned":{"type":"boolean"}}}}}},"responses":{"200":{"description":"This account's saved pin state. Does not change project access or other accounts' pins.","content":{"application/json":{"schema":{"type":"object","required":["id","isPinned"],"properties":{"id":{"type":"string","format":"uuid"},"isPinned":{"type":"boolean"}}}}}},"401":{"description":"A human account session is required."},"403":{"description":"This account cannot read projects."},"404":{"description":"The project is unavailable to this account."},"422":{"description":"Invalid project ID or request body."}}}},"/v1/runs":{"get":{"summary":"Get runs","tags":["Runs"],"description":"The Runs API endpoint allows you to retrieve data about specific runs from your Lunary application.\n\nThe most common run types are 'llm', 'agent', 'chain', 'tool', 'thread' and 'chat'.\n\nIt supports various filters to narrow down the results according to your needs.\n\nThis endpoint supports GET requests and expects query parameters for filtering the results.\n","security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"query","name":"type","schema":{"type":"string","enum":["llm","trace","thread"]}},{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"models","schema":{"type":"array","items":{"type":"string"}}},{"in":"query","name":"tags","schema":{"type":"array","items":{"type":"string"}}},{"in":"query","name":"tokens","schema":{"type":"string"}},{"in":"query","name":"exportType","schema":{"type":"string","enum":["csv","jsonl"]}},{"in":"query","name":"minDuration","schema":{"type":"string"}},{"in":"query","name":"maxDuration","schema":{"type":"string"}},{"in":"query","name":"startTime","schema":{"type":"string"}},{"in":"query","name":"endTime","schema":{"type":"string"}},{"in":"query","name":"parentRunId","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"type":"string"}},{"in":"query","name":"page","schema":{"type":"string"}},{"in":"query","name":"order","schema":{"type":"string"}},{"in":"query","name":"sortField","schema":{"type":"string"}},{"in":"query","name":"sortDirection","schema":{"type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"number"},"page":{"type":"number"},"limit":{"type":"number"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Run"}}}},"example":{"total":200,"page":1,"limit":10,"data":[{"type":"llm","name":"gpt-5","createdAt":"2025-10-01T12:00:00Z","endedAt":"2025-10-01T12:00:03Z","duration":3,"tokens":{"completion":100,"prompt":50,"total":150},"feedback":null,"status":"success","tags":["example"],"templateSlug":"example-template","templateVersionId":1234,"input":[{"role":"user","content":"Hello world!"}],"output":[{"role":"assistant","content":"Hello. How are you?"}],"error":null,"user":{"id":"11111111","externalId":"user123","createdAt":"2021-12-01T12:00:00Z","lastSeen":"2022-01-01T12:00:00Z","props":{"name":"Jane Doe","email":"user1@apple.com"}},"cost":0.05,"params":{"temperature":0.5,"maxTokens":100,"tools":[]},"metadata":null}]}}}}}}},"/v1/runs/usage":{"get":{"tags":["Runs"],"summary":"Get run usage statistics","description":"Retrieve usage statistics for runs","security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"query","name":"days","required":true,"schema":{"type":"string"}},{"in":"query","name":"userId","schema":{"type":"string"}},{"in":"query","name":"daily","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"completion_tokens":{"type":"integer"},"prompt_tokens":{"type":"integer"},"cost":{"type":"number"},"errors":{"type":"integer"},"success":{"type":"integer"}}}}}}},"400":{"description":"Invalid query parameters"}}}},"/v1/runs/export":{"get":{"summary":"Export runs data","tags":["Runs"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"description":"This endpoint requires a valid private API key sent as a bearer token.\n","parameters":[{"in":"query","name":"type","required":true,"schema":{"type":"string","enum":["llm","trace","thread"]}},{"in":"query","name":"exportFormat","required":true,"schema":{"type":"string","enum":["csv","jsonl","ojsonl"]}}],"responses":{"200":{"description":"Export successful","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Invalid Private Key"}}}},"/v1/runs/{id}":{"get":{"summary":"Get a specific run","description":"Retrieve detailed information about a specific run by its ID.","tags":["Runs"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunDetail"}}}},"404":{"description":"Run not found"}}},"delete":{"summary":"Delete a run","description":"Delete a specific run by its ID. This action is irreversible.","tags":["Runs"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Run successfully deleted"},"403":{"description":"Forbidden - User doesn't have permission to delete runs"},"404":{"description":"Run not found"},"409":{"description":"Run has descendants in another project"}}}},"/v1/runs/{id}/visibility":{"patch":{"summary":"Update run visibility","tags":["Runs"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"visibility":{"type":"boolean"}},"example":{"visibility":true}}}}},"responses":{"200":{"description":"Visibility updated successfully"},"400":{"description":"Invalid input"}}}},"/v1/runs/{id}/tags":{"patch":{"summary":"Update run tags","tags":["Runs"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"}}},"example":{"tags":["example","test"]}}}}},"responses":{"200":{"description":"Tags updated successfully"},"400":{"description":"Invalid input"}}}},"/v1/runs/{id}/feedback":{"patch":{"summary":"Feedback Tracking","tags":["Runs","Feedback"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Feedback"},"example":{"thumb":"up","comment":"This response was very helpful!"}}}},"responses":{"200":{"description":"Feedback updated successfully"},"400":{"description":"Invalid input"}}}},"/v1/runs/{id}/score":{"patch":{"summary":"Update run score","tags":["Runs"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"number"},"comment":{"type":"string"}}},"example":{"label":"accuracy","value":0.95,"comment":"High accuracy score"}}}},"responses":{"200":{"description":"Score updated successfully"},"400":{"description":"Invalid input"}}}},"/v1/runs/{id}/related":{"get":{"summary":"Get related runs","tags":["Runs"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Run"}}}}},"404":{"description":"Run not found"}}}},"/v1/runs/ingest":{"post":{"summary":"Ingest run events","description":"This endpoint is for reporting data from platforms not supported by our SDKs.\n\nYou can use either your project's Public or Private Key as the Bearer token in the Authorization header.\n\nThe expected body is an array of Event objects.\n\nFor model calls, you would first track a `start` event with the `input` data.\nOnce your model call succeeds, you would need to send an `end` event to the API endpoint with the `output` data from the model call.\n\nFor a full step-by-step guide on sending LLM data to the Lunary API, see the [Custom Integration](/docs/integrations/custom) guide.\n","tags":["Runs"],"security":[{"ProjectPublicApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"events":{"oneOf":[{"$ref":"#/components/schemas/Event"},{"type":"array","items":{"$ref":"#/components/schemas/Event"}}]}}},"example":{"events":[{"type":"llm","event":"start","runId":"some-unique-id","name":"gpt-4","timestamp":"2022-01-01T00:00:00Z","input":[{"role":"user","content":"Hello world!"}],"tags":["tag1"],"extra":{"temperature":0.5,"max_tokens":100}}]}}}},"responses":{"200":{"description":"Successful ingestion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResponse"},"example":{"results":[{"id":"some-unique-id","success":true}]}}}},"401":{"description":"Project does not exist"},"402":{"description":"Incorrect project id format"}}}},"/v1/template-versions/latest":{"get":{"summary":"Get the latest version","description":"This is the most common endpoint you'll use when working with prompt templates.\n\nThis route is used by the Lunary SDKs to fetch the latest version of a template before making an LLM call.\n\nThis route differs from all the next ones in that:\n- it requires only the `slug` parameter to reference a template\n- it doesn't require using a Private Key to authenticate the request (Public Key is enough)\n","tags":["Templates"],"security":[{"ProjectPublicApiKeyAuth":[]}],"parameters":[{"in":"query","name":"slug","required":true,"schema":{"type":"string"},"description":"Slug of the template"}],"responses":{"200":{"description":"Latest version of the template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateVersion"}}}},"404":{"description":"Template not found"}}}},"/v1/template-versions/{id}":{"patch":{"summary":"Update a template version","tags":["Templates"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"ID of the template version"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateVersionUpdateInput"}}}},"responses":{"200":{"description":"Updated template version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateVersion"}}}},"401":{"description":"Unauthorized access"}}}},"/v1/templates":{"get":{"summary":"List all templates","description":"List all the prompt templates in your project, along with their versions.\nUseful for usecases where you might want to pre-load all the templates in your application.\n","tags":["Templates"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Template"}}}}}}},"post":{"summary":"Create a new template","description":"Creates a new template with the provided details.\nThe template includes a slug, mode, content, and additional configuration options.\n","tags":["Templates"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateInput"},"example":{"slug":"greeting-template","mode":"openai","content":[{"role":"system","content":"You are a friendly AI assistant."},{"role":"user","content":"Hello, how are you?"}],"extra":{"temperature":0.7,"max_tokens":150},"isDraft":false,"notes":"Initial greeting template"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"},"example":{"id":"123e4567-e89b-12d3-a456-426614174000","slug":"greeting-template","mode":"openai","createdAt":"2023-06-01T12:00:00Z","versions":[{"id":"789e0123-e45b-67d8-a901-234567890000","content":[{"role":"system","content":"You are a friendly AI assistant."},{"role":"user","content":"Hello, how are you?"}],"extra":{"temperature":0.7,"max_tokens":150},"isDraft":false,"notes":"Initial greeting template","createdAt":"2023-06-01T12:00:00Z","version":1}]}}}}}}},"/v1/templates/{id}":{"get":{"summary":"Get a specific template","description":"Get a specific prompt template and all its versions by its ID.\n","tags":["Templates"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"},"example":{"id":"123e4567-e89b-12d3-a456-426614174000","name":"Customer Support Chat","slug":"customer-support-chat","mode":"openai","createdAt":"2023-01-01T00:00:00Z","projectId":"987e6543-e21b-12d3-a456-426614174000","versions":[{"id":"abcd1234-e56f-78g9-h012-ijklmnopqrst","templateId":"123e4567-e89b-12d3-a456-426614174000","content":[{"role":"system","content":"You are a helpful customer support agent."},{"role":"user","content":"Hello, I have a question about my order."},{"role":"assistant","content":"Of course! I'd be happy to help you with your order. Could you please provide me with your order number?"}],"extra":{"temperature":0.7,"maxTokens":150},"testValues":{"orderNumber":"ORD-12345"},"isDraft":false,"notes":"Updated to improve response clarity","createdAt":"2023-01-02T12:00:00Z","version":1}]}}}},"404":{"description":"Template not found"}}},"delete":{"summary":"Delete a template","tags":["Templates"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successful deletion"}}},"patch":{"summary":"Update a template","description":"This endpoint allows you to update the slug and mode of an existing template.\nThe mode can be either \"text\" or \"openai\" (array of chat messages).\n","tags":["Templates"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"The ID of the template to update"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateUpdateInput"},"example":{"slug":"updated-customer-support-chat","mode":"openai"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"},"example":{"id":"123e4567-e89b-12d3-a456-426614174000","slug":"updated-customer-support-chat","mode":"openai","projectId":"456e7890-e12b-34d5-a678-426614174111","createdAt":"2023-01-01T00:00:00Z","versions":[{"id":"789e0123-e45b-67d8-a901-426614174222","templateId":"123e4567-e89b-12d3-a456-426614174000","content":[{"role":"system","content":"You are a helpful customer support agent."},{"role":"user","content":"I have a question about my order."}],"extra":{"temperature":0.7,"max_tokens":150},"testValues":{"orderNumber":"ORD-12345"},"isDraft":false,"notes":"Updated version for improved customer support","createdAt":"2023-01-02T12:00:00Z","version":1}]}}}},"400":{"description":"Invalid input"},"404":{"description":"Template not found"}}}},"/v1/templates/{id}/versions":{"post":{"summary":"Create a new version","description":"This endpoint allows you to push a new version of a prompt.\nYou can specify the content, extra parameters, test values, draft status, and notes for the new version.\n","tags":["Templates","Versions"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"The ID of the template to create a new version for"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateVersionInput"},"example":{"content":"Hello {{name}}, welcome to {{company}}!","extra":{"temperature":0.7,"max_tokens":150},"isDraft":false,"notes":"Updated welcome message with company name"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateVersion"},"example":{"id":"123","templateId":"456","content":"Hello {{name}}, welcome to {{company}}!","extra":{"temperature":0.7,"max_tokens":150},"isDraft":false,"notes":"Updated welcome message with company name","createdAt":"2023-06-01T12:00:00Z","version":2}}}}}}},"/v1/test-endpoint":{"post":{"summary":"Test endpoint for playground API testing","description":"A public endpoint that echoes back the request data for testing the playground custom API feature","tags":["Test"],"security":[{"ProjectPublicApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Successful response with echoed data","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Success message"},"receivedAt":{"type":"string","format":"date-time","description":"When the request was received"},"echo":{"type":"object","description":"The request data echoed back"},"headers":{"type":"object","description":"Request headers received"},"method":{"type":"string","description":"HTTP method used"}}}}}}}}},"/v1/test-endpoint/auth":{"post":{"summary":"Test endpoint with authentication check","description":"A test endpoint that validates authentication headers","tags":["Test"],"security":[{"ProjectPublicApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Successful response with authentication info"},"401":{"description":"Unauthorized - missing or invalid authentication"}}}},"/v1/views":{"get":{"summary":"List all views","description":"Retrieves a list of all views for the current project, ordered by most recently updated.","tags":["Views"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/View"}},"example":[{"id":"1234abcd","name":"LLM Conversations","data":["AND",{"id":"models","params":{"models":["gpt-4"]}}],"columns":{"id":"ID","content":"Content"},"icon":"chat","type":"llm","projectId":"project123","ownerId":"user456","updatedAt":"2023-04-01T12:00:00Z"}]}}}}},"post":{"summary":"Create a new view","description":"Creates a new dashboard view with the provided details.","tags":["Views"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ViewInput"},"example":{"name":"New LLM View","data":["AND",{"id":"models","params":{"models":["gpt-4"]}}],"icon":"chart","type":"llm"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/View"},"example":{"id":"5678efgh","name":"New LLM View","data":["AND",{"id":"models","params":{"models":["gpt-4"]}}],"columns":[],"icon":"chart","type":"llm","projectId":"project123","ownerId":"user456","updatedAt":"2023-04-01T14:30:00Z"}}}}}}},"/v1/views/{id}":{"get":{"summary":"Get a specific view","description":"Retrieves details of a specific view by its ID.","tags":["Views"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/View"},"example":{"id":"1234abcd","name":"LLM Conversations","data":["AND",{"id":"models","params":{"models":["gpt-4"]}}],"columns":{"id":"ID","content":"Content"},"icon":"chat","type":"llm","projectId":"project123","ownerId":"user456","updatedAt":"2023-04-01T12:00:00Z"}}}},"404":{"description":"View not found"}}},"patch":{"summary":"Update a view","description":"Updates an existing view with the provided details.","tags":["Views"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ViewUpdateInput"},"example":{"name":"Updated LLM View","data":["AND",{"id":"models","params":{"models":["gpt-4","gpt-3.5-turbo"]}}],"icon":"user"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/View"},"example":{"id":"1234abcd","name":"Updated LLM View","data":["AND",{"id":"models","params":{"models":["gpt-4","gpt-3.5-turbo"]}}],"columns":[],"icon":"user","type":"llm","projectId":"project123","ownerId":"user456","updatedAt":"2023-04-02T10:15:00Z"}}}}}},"delete":{"summary":"Delete a view","description":"Deletes a specific view by its ID.","tags":["Views"],"security":[{"ProjectPrivateApiKeyAuth":[]}],"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful deletion","content":{"application/json":{"example":{"message":"View successfully deleted"}}}}}}}},"tags":[]}