Skip to content

API reference

REST JSON API and MCP server. Authenticate with a bearer key in the Authorization header: create one under Settings → API once you've made an organization. Swap your-org-slug-goes-here and YOUR_TOKEN below for your own.

MCP Server

Connect Claude Code, Cursor, or any MCP client to manage prompts, runs, datasets, and metrics conversationally. 54 tools over streamable HTTP.

▶ Claude Code
claude mcp add --transport http completion-kit \
  https://completionkit.com/orgs/your-org-slug-goes-here/mcp \
  --header "Authorization: Bearer YOUR_TOKEN"
{} Cursor / Generic
{
  "mcpServers": {
    "completion-kit": {
      "url": "https://completionkit.com/orgs/your-org-slug-goes-here/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

Available tools

prompts 7

prompts_list List every prompt in CompletionKit, newest first. Each version of a prompt is its own entry, so drafts and older versions appear next to the published one. Versions of the same prompt share a family_key, and current=true marks the published version that apps get when they fetch the prompt by name or family_key. Returns each version's id, name, description, template, llm_model, family_key, version_number, current, timestamps and tags. Use it to find a prompt's ID before you test it, edit it, compare its versions or ask for a suggested improvement.
prompts_get Get one prompt version by its numeric ID. Returns its name, description, template text with {{variable}} placeholders, the model that answers it (llm_model), family_key, version_number, whether it is the published version (current), timestamps and tags. Use it to read a prompt before you edit it, test it in a run or compare it with another version.
prompts_create Create a new prompt to test. Give it a name, a template with {{variable}} placeholders that match your dataset's column names, and the model that should answer it (llm_model). The model name is checked against the models your saved provider keys serve. If CompletionKit has not found any models from a saved key yet, any model name is accepted, and runs fail until a key for that model's provider is added. The new prompt is version 1 of a new prompt family and is published right away. If another published prompt already has the same name, apps that fetch prompts by name get this new one instead. To change an existing prompt, use prompts_update so its versions stay together. tag_names creates any tags that don't exist yet. Returns the saved prompt with its ID. To test it, create a run with runs_create and start it with runs_generate.
prompts_update Edit a prompt's name, description, template, model or tags. Changing the template or model of the published version, or editing any version that already has runs, creates a new DRAFT version (current=false) instead of changing it, so an agent's edits don't go live without a gate. The draft copies the old version's name, description, template and model, with your changes applied. Run and compare the draft, then promote it with prompts_publish. An unpublished draft with no runs, or a name, description or tag change on a published version with no runs, is updated in place and the old values are not kept. Renaming a published version in place takes effect at once, so apps that fetch it by its old name stop finding it, while fetches by family_key or ID still work. tag_names replaces the whole tag list. A new draft does not copy the old version's tags, so pass tag_names to keep them, or the draft has no tags, even after it is published. Returns the saved version, which has a new ID when a draft was created.
prompts_delete Permanently delete one prompt version by ID, along with every run of that version and all of those runs' responses, scores, judge reviews, agreements and suggestions. Other versions of the prompt, and your datasets, metrics and tags, are kept. Apps that fetch this version by its ID get a not-found error. If you delete the published version, no other version is published in its place, so apps that fetch the prompt by family_key get a not-found error, and apps that fetch it by name get a not-found error or another published prompt with the same name, until you publish another version with prompts_publish. This cannot be undone. Returns a confirmation message.
prompts_publish Publish a prompt version, making it the current version. Apps that fetch the prompt by its name or family_key get this version from their next request, and the version that was published before stops being current. Use it to ship a draft from prompts_update once a run shows it scores at least as well, or to roll back by publishing an older version. Returns the published version.
prompts_suggest_improvement Suggest an improved version of a prompt, grounded in a run's test results and judge feedback. It reads up to 20 of the run's responses with their scores and reviews, then asks the prompt's own model, on your saved provider key, for reasoning plus a rewritten template that keeps the {{variables}}. It then tests the rewrite on up to 30 of the run's judge-scored rows and scores the new answers with the run's LLM-judge metrics and judge model. Returns suggestion_id, prompt_id, reasoning, suggested_template, original_template, validation (before and after averages and how many rows improved, regressed or stayed the same) and net_negative, which is true when the rewrite's average score fell or more rows got worse than better. If validation.tested is 0, nothing was checked and net_negative is false. That happens when the run has no LLM-judge metrics, has no judge-scored rows with both input and output, or every test call failed. It saves the result as a Suggestion. The prompt itself is not changed, so pass suggested_template to prompts_update to save it as a draft version. Requires a run that has a prompt (not a scoring-only run). Each call can make dozens of model calls on your saved provider keys and can take a while.

runs 9

runs_list List your test runs, newest first. A run tests one prompt version against a dataset, or grades existing outputs, and scores each response with your metrics. It returns each run's id, name, status (pending, running, completed or failed), prompt and dataset ids, judge model, average score (1 to 5, 5 is best), check pass rate, per-metric averages and progress. Runs older than the account's history window may be left out. Use it to find a run's id or see recent results, then call runs_get for one run.
runs_get Get one test run's results by id: status, progress, average score (1 to 5, 5 is best), check pass rate, the ids of failed responses, any failure reason, and "metric_averages", a per-metric breakdown with each metric's average score (or pass rate for checks), how many rows it graded, and how many scored low. Use this to see how a prompt scored and to find the metric dragging a prompt down without listing responses. Poll it after runs_generate, runs_regrade or runs_rerun until status is completed or failed. The result includes a warning when no metrics are attached or when the judge's scores are not reproducible.
runs_create Set up a test run that scores a prompt's responses on a dataset. Give prompt_id and dataset_id to test a prompt: each dataset row fills the prompt's variables, the prompt's model answers it, and that answer gets scored. Omit prompt_id and provide output_column to score existing outputs by grading a pre-existing dataset column instead of generating new ones. Attach metrics with metric_ids or metric_group_id, and set judge_model, or LLM-judged metrics are skipped; with no metrics the run scores nothing. It fails if the dataset is missing a column the run needs, such as one the prompt uses, or if no configured provider serves judge_model. This only creates the run; call runs_generate to start it. It returns the new run, with a warning if no metrics are attached or if judge_temperature is above 0, which makes scores irreproducible.
runs_update Change a test run's settings: name, dataset, judge model, temperature, judge temperature, max tokens, output and expected columns, metrics or tags. The prompt cannot be changed. Passing metric_ids or metric_group_id replaces the run's whole metric list, and tag_names replaces all of its tags. It does not regenerate or rescore anything, and existing responses and scores stay as they are; call runs_regrade to rescore with the new metrics, or runs_rerun for a fresh run. It returns the updated run with the same warnings as runs_get.
runs_delete Permanently delete a test run and everything in it: its generated responses, their scores and judge feedback, the human agreement verdicts recorded on it (which also drops them from the judge's agreement stats), and any prompt suggestions made from it. This cannot be undone. The prompt, dataset and metrics are kept. Confirm with the user before calling. It returns a short confirmation message.
runs_generate Start a test run so it produces and scores responses. It is required for every run, including score-only runs (no prompt): it generates responses with the prompt when there is one, and otherwise copies the graded dataset column and grades it. In a prompt run each dataset row goes to the prompt's model, and in either kind of run each LLM-judged metric then scores the result with the run's judge model. LLM-judged metrics are skipped when the run has no judge model. These model calls go to the providers you configured, which may charge for them; checks run without a provider call. The work runs in the background, so poll runs_get until status is completed or failed, and do not call this tool again to check progress. Only a pending or failed run can start, and any refused start marks the run as failed. Calling it on a running or completed run therefore does not start it but marks that run as failed, and a second call would then delete its results. Restarting a failed run first deletes its earlier responses, their scores and any human verdicts on them. For a completed run use runs_rerun, runs_retry_failures or runs_regrade instead. It returns the run with its progress, or the reason it could not start, such as a missing provider key or an empty dataset.
runs_regrade Re-score a test run's existing responses with its currently attached metrics, without regenerating. Use it after attaching or editing metrics on an already-generated run. It first clears every existing score and judge comment on the run's succeeded responses, including scores for metrics no longer attached, so the earlier scores are lost. If the run has checks but no judge model, its LLM-judged scores are cleared and not replaced. Human verdicts already recorded on the run are kept even though people gave them on the earlier scores, and agreement stats then pair them with the new scores. LLM-judged metrics call your judge model's provider; checks do not. The work runs in the background, so poll runs_get for progress. It returns the run, or an error when no configured provider serves the judge model, or when there is nothing to re-grade because the run has no succeeded responses, no metrics, or only LLM-judged metrics and no working judge model.
runs_rerun Copy a test run and start the copy, with the same prompt version, dataset, metrics, judge model, settings and tags, under a new automatic name. Use it when the judge changed and you want a clean run instead of mixing versions, or to repeat a test. The original run and its scores stay untouched. The copy runs in the background and calls your model providers the same way runs_generate does. To test a different prompt version, create a new run with runs_create instead. It returns the new run; poll runs_get with its id for progress. If the prompt's model or the judge model has no configured provider, or the dataset no longer has a column the run needs, it returns an error and creates nothing. If the copy is created but cannot start, for example because the dataset is empty, it returns the reason and the copy stays as a failed run.
runs_retry_failures Retry only the parts of a test run that failed, such as provider timeouts, rate limits or judge errors. Failed responses are generated again and failed scores are retried, while responses and scores that succeeded are left alone; optionally limit it to specific response ids via "only". It is refused when the judge has changed since the run executed, meaning a metric on the run now has a newer version than the one that scored it, because a retry would mix versions in the same run; use runs_rerun instead. The retries run in the background and call your model providers, except for checks. It returns the run with its progress, or the run unchanged when nothing failed.

responses 2

responses_list List the AI responses in a run with their scores, in row order, to see which test cases scored well or badly and why. Each row has the input, the response_text, the expected_output, an average judge score from 1 to 5 (5 is best), and each metric's review with judge feedback or a check's pass/fail. Returns {total, limit, offset, returned, responses}. Defaults to 50 rows because full payloads are large: use "fields" to drop the bodies, "min_score"/"max_score" to isolate low scorers, and sort "score_asc" to read the worst rows first. Rows with no judge score, such as rows graded only by checks, are left out by a score filter and listed last by a score sort. For per-metric averages of the whole run use runs_get instead of aggregating here.
responses_get Get one response from a run in full, by run_id and response id. The response must belong to that run. Returns the input, the complete response_text, the expected_output, the average judge score from 1 to 5 (5 is best), each metric's review with the judge's score and feedback or the check's pass/fail, the row's status and attempts, and any provider error. Use it to read a single test case closely after responses_list points you to it.

datasets 6

datasets_list List every test dataset in your CompletionKit account, newest first. Returns each dataset's id, name, full CSV data, tags and timestamps, so the result can be large when your datasets are big. Use it to find a dataset to test a prompt against or to score AI responses on. To read one dataset, use datasets_get.
datasets_get Get one test dataset by its ID. Returns the dataset's name, its full CSV data (header row first, then one test case per row), its tags and its timestamps. Use it to check a dataset's columns and rows before you test a prompt or start a run against it.
datasets_create Create a test dataset from CSV text included in the call. The first row is the header, and each later row is one test case. Every column is available to the prompt as a variable. Two column names are recognized specially: "expected_output" is each row's answer key (ground truth) given to the judge and to checks that compare against the row's expected value, and "actual_output" is a pre-made output to score in a prompt-less run. Both are overridable per run (expected_column / output_column). Optional tag_names labels the dataset. Tag names are lowercased and may contain only unaccented letters, numbers, spaces, hyphens and underscores, up to 64 characters, and tags that don't exist yet are created. Returns the new dataset. The CSV is rejected if it is empty, is not valid UTF-8, has a blank header row or a header row over 64 KB, or is larger than the upload limit (25 MB by default). If the CSV is too big to put in the call, use datasets_create_from_url, which downloads files up to 10MB.
datasets_update Change a test dataset's name, CSV data or tags. Passing csv_data replaces the whole CSV, and the dataset keeps no copy of the old version. Passing tag_names replaces all of the dataset's tags. Responses from runs that already ran keep the row values they used, but any run started after the change reads the new rows. If you remove or rename a column that a run needs (a variable in its prompt, its expected_column or its output column), that run cannot be started, finished, regraded, retried or rerun until the column is back. To add rows, read the dataset with datasets_get first and send back the full CSV. Returns the updated dataset. If tag_names is rejected, the name and CSV changes in the same call are still saved.
datasets_delete Permanently delete a test dataset. This also deletes every run that used it, with those runs' responses, scores, suggestions and human agreement labels. Prompts and metrics are kept. This cannot be undone, so confirm with the user before calling it. Returns a short confirmation.
datasets_create_from_url Create a test dataset by downloading a CSV file from a public http(s) URL instead of pasting it into the call. Use this for large datasets: the server fetches the CSV directly, so the data never has to pass through the tool-call arguments. The URL is SSRF-checked, so it cannot point at private network addresses. Redirects are not followed and return an error, and files over 10MB are rejected. The first row is the header. The "expected_output" (answer key) and "actual_output" (pre-made output) columns are recognized specially, and both are overridable per run. Optional tag_names labels the dataset. Returns the new dataset, or an error that says why the URL, the download or the CSV was rejected.

metrics 6

metrics_list List every metric in your workspace, newest first. A metric is how CompletionKit scores AI responses. It is either an LLM judge, which grades each response from 1 to 5 (5 is best) against an instruction and rubric, or a check, which scores a response by an exact rule such as contains, equals, regex, valid JSON, a JSON path value, length or number bounds, or list overlap. Returns each metric's id, name, key, type, tags and timestamps, plus its instruction and rubric bands (judges) or its check_config (checks). The full list comes back with no paging. Use it to find a metric id before you score a run, edit a judge or build a metric group.
metrics_get Get one metric by id. Returns its id, name, key, type, tags and timestamps, plus its live judge instruction and 1 to 5 rubric bands (for an LLM judge) or its check_config (for a check). Use it to read exactly how a metric scores AI responses before you change it or explain a score. To see its saved versions and drafts, use metric_versions_list.
metrics_create Create a metric that scores AI responses. By default it is an LLM judge. Send name and instruction (what a good response looks like), and optionally rubric_bands describing 1 to 5 stars, where 5 is best. Any band you leave out gets a default description. For an exact rule instead of a judge, see the check details at the end. The metric's name must be unique in the workspace, ignoring case, spaces and most punctuation, and a renamed metric keeps its original name reserved. A clash fails with the error "Key has already been taken". tag_names adds tags and creates any that don't exist yet. Saving a metric scores nothing by itself. Attach it to a run with runs_create or runs_update, then score responses with runs_generate or runs_regrade. Returns the saved metric. For a deterministic check set metric_type:"check" and check_config. Per-kind required keys: value (contains/not_contains/equals/list_overlap/numeric_equals), pattern (regex), json_path+expected (json_path_equals), min and/or max (length_bounds/numeric_bounds); valid_json takes no extra keys. target_path is required when target is json_path; a target_path sent with no target sets target to json_path, and one sent with any other target is refused. target_path walks array indices, as in items.0.name; any path may start at the root with $., as in $.items.0.name. list_overlap grades a list-valued field and stores a fraction rather than a verdict: score_by is recall, precision, f1 or jaccard (recall by default), and min is the fraction that counts as a pass (1, a perfect score, by default). numeric_bounds and numeric_equals read a number, ignoring the thousands commas and currency symbol a figure is written with; a comma counts only as a thousands separator, with three digits after it and no decimal point before it, so 1,5 is not a number; numeric_equals takes a tolerance, either a plain number for a fixed amount or a percentage string such as 2% for a share of the expected value. A check with no case_sensitive matches case-insensitively, regex and list_overlap included; send case_sensitive: true to match case exactly. Before 0.29.0 a regex check read a missing case_sensitive as case-sensitive. Set compare_to:"expected" on contains, not_contains, equals, json_path_equals, list_overlap, numeric_equals to grade against each row's own expected_output (ground truth) instead of a constant; drop value (or expected, for json_path_equals) and add expected_path to dig into the answer key when it is JSON.
metrics_update Change a metric's name, judge instruction, rubric bands, check_config, type or tags. This overwrites the metric in place, and the new definition scores every response graded after it. It saves no draft or new version. If the metric already has a live version, scores and verdicts given after the change are still filed under that version, so judges_compare can't tell the old and new definitions apart. Responses already scored keep their old scores until you rescore the run with runs_regrade. Nothing tests the change before it goes live. Fields you leave out stay as they are, but a field you send replaces that whole field: rubric_bands resets any band you leave out to its default description, not its old one, and check_config replaces the whole config. tag_names replaces the whole tag set. A rename keeps the metric's original key, so its old name stays reserved. metric_type cannot change once the metric is in a run, has scores or has versions. Returns the updated metric. For a deterministic check set metric_type:"check" and check_config. Per-kind required keys: value (contains/not_contains/equals/list_overlap/numeric_equals), pattern (regex), json_path+expected (json_path_equals), min and/or max (length_bounds/numeric_bounds); valid_json takes no extra keys. target_path is required when target is json_path; a target_path sent with no target sets target to json_path, and one sent with any other target is refused. target_path walks array indices, as in items.0.name; any path may start at the root with $., as in $.items.0.name. list_overlap grades a list-valued field and stores a fraction rather than a verdict: score_by is recall, precision, f1 or jaccard (recall by default), and min is the fraction that counts as a pass (1, a perfect score, by default). numeric_bounds and numeric_equals read a number, ignoring the thousands commas and currency symbol a figure is written with; a comma counts only as a thousands separator, with three digits after it and no decimal point before it, so 1,5 is not a number; numeric_equals takes a tolerance, either a plain number for a fixed amount or a percentage string such as 2% for a share of the expected value. A check with no case_sensitive matches case-insensitively, regex and list_overlap included; send case_sensitive: true to match case exactly. Before 0.29.0 a regex check read a missing case_sensitive as case-sensitive. Set compare_to:"expected" on contains, not_contains, equals, json_path_equals, list_overlap, numeric_equals to grade against each row's own expected_output (ground truth) instead of a constant; drop value (or expected, for json_path_equals) and add expected_path to dig into the answer key when it is JSON.
metrics_delete Permanently delete a metric. This also deletes all of its versions and drafts and every human agree, disagree or borderline verdict recorded against them. It removes the metric from every run and metric group and unlinks its tags, though the tags themselves stay. Scores it already gave stay on their responses but are no longer linked to the metric. This cannot be undone. Returns a confirmation message.
metrics_suggest_variants Get AI suggestions to improve an LLM judge that disagrees with people. It sends the judge's current instruction and rubric, plus up to 8 recent responses where a person disagreed with the judge's score and up to 6 that a person marked borderline (each input and output cut to 200 characters), to your own model provider. The model is asked for rewrites of the instruction, the rubric or both that close the gap. Each rewrite is saved as a draft metric version with source "suggestion", and earlier suggestion drafts are kept. The live judge does not change until you publish a draft with metric_versions_publish. Nothing tests a draft before you publish it. Once it is live and people have recorded verdicts on it with agreements_create, judges_compare shows whether it agrees with people more often than the version it replaced. Returns the saved drafts. It works best after you have recorded disagreements with agreements_create. Checks are refused, because they are exact and have nothing to suggest. count defaults to 1 and is capped at 3. model picks the model that writes the rewrites and defaults to your judge model. The call uses your provider key and runs while you wait. It fails with an error if no judging model is set up or the model you name is unknown. If the model's reply can't be read, nothing is saved and you get a "no parseable variants" error. A call your provider refuses, such as one with a bad key, usually ends in that same error.

metric 8

metric_groups_list List every metric group in your workspace, newest first. A metric group is a saved, ordered set of metrics that you can attach to a run in one step, so runs are scored the same way each time. Returns each group's id, name, description, metric_ids, tags and timestamps. The full list comes back with no paging. Use it to find a metric_group_id for runs_create or runs_update.
metric_groups_get Get one metric group by id. Returns its id, name, description, the ids of its metrics in order, tags and timestamps. Use metrics_get on each id to see how each metric scores AI responses.
metric_groups_create Create a metric group: a named, ordered set of metrics that you can attach to a run in one step with metric_group_id, so every run of a prompt is scored the same way. Send name, and optionally description, metric_ids in the order you want them and tag_names (any new tags are created). Each id must be a metric in this workspace, or the whole call fails. A run copies the group's metrics when you attach the group, so later changes to the group don't reach that run. Returns the saved group.
metric_groups_update Change a metric group's name, description, metrics or tags. This overwrites the group in place. metric_ids replaces the group's whole metric list in the order given, and an empty list removes every metric. Each id must be a metric in this workspace. Leave metric_ids out to keep the current list. tag_names replaces the whole tag set. Runs already created keep the metrics they had. Returns the updated group.
metric_groups_delete Permanently delete a metric group. Its tags are unlinked, though the tags themselves stay. The metrics in it, and any runs scored with it, stay as they are. This cannot be undone. Returns a confirmation message.
metric_versions_list List every version of one metric's judge or check, drafts and published, newest first. Use it to see how a judge changed over time, find drafts suggested by metrics_suggest_variants or saved from edits in the web app, or pick an older version to restore with metric_versions_publish. Each row carries id, version_number, state (draft or published), source, the current flag marking the live version, and timestamps, plus that version's instruction and rubric bands (judges) or check_config (checks). source is edit or suggestion for versions made those ways, and null for a version saved automatically the first time the metric scored a response or got a verdict. The current version can differ from the metric's live definition if metrics_update changed the metric after that version was saved.
metric_versions_publish Make a metric version the live judge or check that scores new AI responses. It works both to publish a draft and to switch back to an older published version. In one step it marks this version current, marks every other version of the metric not current, and writes this version's instruction and rubric bands (or check_config, for a check) onto the metric, replacing what the metric had. Responses already scored keep their scores. Rescore a run with runs_regrade if you want new ones. Human verdicts stay with the version they were given on. Other published versions stay saved, so you can switch back by publishing one, but a live definition that was never saved as a version is lost. A check version with an invalid check_config is refused. Returns the published version.
metric_versions_dismiss Permanently delete a draft version of a metric, whether it came from an edit in the web app or from metrics_suggest_variants. Use it to throw away a suggested judge rewrite you don't want. Published versions are refused. To stop using a published version, publish a different one as current instead. This cannot be undone. Returns the deleted version's id with destroyed: true.

provider 5

provider_credentials_list List the model provider connections saved in your CompletionKit account (OpenAI, Anthropic, Ollama or another OpenAI-compatible endpoint, OpenRouter, Azure AI Foundry). Returns each one's id, provider, custom endpoint, API version and timestamps. API keys are not exposed. Use it to see which providers are connected before you test a prompt, start a run or use an LLM judge. It does not show whether a key is still stored or whether the provider's models loaded.
provider_credentials_get Get one saved model provider connection by its ID. Returns its provider, custom endpoint, API version and timestamps. The API key is not exposed. Use it to check how a provider is set up before you change it.
provider_credentials_create Save an API key for a model provider (openai, anthropic, ollama for Ollama or any other OpenAI-compatible endpoint, openrouter or azure_foundry) so CompletionKit can run your prompts and LLM judges with it. You can save one credential per provider. azure_foundry requires api_endpoint, ollama needs api_endpoint for its models to load, and any api_endpoint must be an http(s) URL that resolves to a public address. The key is stored encrypted and is never returned. Saving starts a background job that lists the provider's models. For every provider except openrouter, the job then sends each model that has not been tested yet a short test prompt to check it can generate text and, if it can, a second one to check it can judge, and these requests use your key. Returns the saved credential without the key.
provider_credentials_update Change a saved model provider connection: its API key, provider, custom endpoint or API version. A new api_key replaces the stored key, and the old key cannot be recovered. An empty api_key clears the stored key. Changing provider or api_endpoint on a credential with a stored key requires api_key in the same call, so a stored key never moves to a new provider or endpoint. Each provider can have only one credential. Any api_endpoint must be an http(s) URL that resolves to a public address. Each successful save runs model discovery again in the background. It lists the provider's models and, for every provider except openrouter, sends each model that has not been tested yet a short test prompt to check it can generate text and, if it can, a second one to check it can judge, using the key. Models the provider no longer lists are marked retired, and prompts or judges set to a retired model can fail to run. Returns the credential without the key.
provider_credentials_delete Permanently delete a saved model provider connection and its stored API key, and remove that provider's models from your model list. It is refused with an error while any current prompt version uses one of that provider's models, or while any run, including past runs, used one of them as its judge. This cannot be undone, so confirm with the user before calling it. Returns a short confirmation.

tags 5

tags_list List every tag in CompletionKit, in name order. Returns each tag's id, name, color and timestamps. Tags label prompts, datasets, metrics, metric groups and runs. Use this to see which labels exist, or to find a tag's ID before renaming or deleting it.
tags_get Get one tag by ID. Returns its id, name, color and timestamps. Use it to check a tag's current name before you rename it or pass it in tag_names.
tags_create Create a tag for labelling prompts, datasets, metrics, metric groups and runs. The name is trimmed and lowercased. It may contain only the letters a to z, digits, spaces, hyphens and underscores (accented and non-Latin letters are rejected), can be up to 64 characters, and must not match an existing tag. Color is auto-assigned. Returns the new tag. You don't need this tool before tagging a record, because the create and update tools for those records take tag_names and create missing tags for you.
tags_update Rename a tag. Pass the new name; leaving it out returns an error. The name follows the same rules as tags_create and can't match another tag, because tags are not merged. The new name shows at once on every prompt, dataset, metric, metric group and run that carries the tag. Returns the updated tag.
tags_delete Delete a tag. Removes the tag from every linked metric, metric group, prompt, run, and dataset; those records themselves are kept. This cannot be undone. Use tags_update instead if you only want to rename it. Returns a confirmation message.

agreements 2

agreements_list List human reviews of the LLM judge's scores: each agree, disagree or borderline verdict, with any corrected score and note. Filter by run_id, response_id, metric_id, or created_by. Use it to see where people disagreed with the judge before improving a metric's rubric. It returns each verdict, oldest first, with its run, response, metric and metric version ids, who recorded it and when.
agreements_create Record whether a person agrees with the LLM judge's score on one response for one metric, so you can measure how far to trust the judge. The response must belong to the given run. Verdict is one of agree, disagree, borderline. corrected_score (1..5) is required when verdict is 'disagree'. This upserts an agreement for (run, response, metric, created_by): a new verdict with the same created_by (default "mcp") replaces the earlier one, including its corrected score and note, and leaving either out clears it. The verdict is filed under the metric's current judge version, which is the version judges_compare counts it for, even when an earlier version scored that response. It works only for llm_judge metrics, because checks have nothing to calibrate. It returns the saved verdict.

judges 2

judges_replay Check an LLM judge against outputs you already have: set up a scoring run that grades a dataset column of existing outputs with one metric's current judge and the judge_model you name (wraps runs_create with prompt_id omitted and output_column supplied, defaulting to actual_output). This only sets up the run; call runs_generate to actually re-judge the outputs so you can compare against human verdicts. It returns the new run.
judges_compare Compare two versions of one metric's LLM judge to see which agrees more with human reviewers. It computes stats from the agreement verdicts already recorded under each version and saves nothing; verdicts on runs older than the account's history window are not counted. It requires metric_id, metric_version_a_id, and metric_version_b_id (both versions must belong to that metric). It returns, for each version, the number of verdicts, the agreement rate with its confidence range, borderline rate, mean absolute error and kappa, plus the change from A to B and a recommendation. The recommendation is need_more_data under 30 verdicts combined, recommend when B's agreement rate beats A's by more than 3 points, hold when it trails A's by more than 3 points, and no_change otherwise or when one version has no verdicts. It is unavailable for check metrics.

promptfoo 1

promptfoo_import Import a promptfoo config (the full promptfooconfig.yaml text) so you can test its prompts and score their responses in CompletionKit. It creates a new prompt for each inline prompt template, one dataset from the tests' vars, and metrics from the assert blocks in tests and defaultTest, with identical asserts imported once. llm-rubric, g-eval, model-graded-closedqa and factuality become LLM judge metrics. contains, icontains, not-contains, not-icontains, equals, regex and is-json become deterministic check metrics. Prompts use the model named by the first provider, or gpt-4o if none is given, and are created even if no saved provider key serves that model. Prompts given as file:// references are skipped, so paste the file's contents instead. It only adds new records, never changes existing ones and does not start a run. Providers are only matched by name against your saved provider keys and reported as matched or unmatched. Any apiKey in the config is ignored, so remove keys before pasting. Returns a summary of what was created and of the prompts and assert types it skipped, with the reason for each. Assert options such as threshold, weight and provider, defaultTest vars, and asserts with no type are dropped without being listed in the summary. If a prompt or the dataset cannot be saved, the whole import is rolled back and nothing is created.

usage 1

usage_get Get this organization's plan usage and limits for the current billing period: runs and prompt fetches used, their limits, how many remain, and when the period resets. Call this to pre-check quota before starting runs. Runs are hard-blocked once the run limit is reached (with a small grace band), so a run over the limit will fail with run_limit_reached. It also returns the organization's name, slug and the link where an owner adds model keys. Plans and billing are managed only on the CompletionKit website.

Prompts

Create, version, and manage LLM prompt templates.

GET /api/v1/prompts

List all prompts, ordered by most recent. Supports pagination (limit, offset) and tag[] filtering.

curl https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/prompts \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/prompts

Create a new prompt.

Required: name, template, llm_model Optional: description

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/prompts \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "summarizer", "template": "Summarize: {{text}}", "llm_model": "gpt-4.1"}'

GET /api/v1/prompts/:id

Get a single prompt by numeric ID or slug.

PATCH /api/v1/prompts/:id

Update a prompt. Accepts same params as create. If the prompt has no runs it is updated in place; if it already has runs, a new version is created and returned (with a new id), leaving the original unchanged. The new version is published unless you send "publish": false, which saves it as an unpublished draft you can run and compare first, then publish with POST /api/v1/prompts/:id/publish. With "publish": false, a template or model change to the published version is saved as a draft even when it has no runs, so what your app fetches doesn't change. publish must be true or false; any other value returns 422.

curl -X PATCH https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/prompts/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"template": "Summarize concisely: {{text}}"}'

DELETE /api/v1/prompts/:id

Delete a prompt. Returns 204 No Content.

POST /api/v1/prompts/:id/publish

Publish a prompt version, making it the current version in its family.

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/prompts/1/publish \
  -H "Authorization: Bearer YOUR_TOKEN"

Runs

Create runs, generate LLM responses, and judge them with metrics.

GET /api/v1/runs

List runs with response counts and average scores. Supports pagination (limit, offset) and the following filters.

Optional filters: status (pending, running, completed, failed), prompt_id, dataset_id, tag[]

curl "https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs?status=completed&prompt_id=1&tag[]=real%20estate" \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/runs

Create a new run.

Optional: name, prompt_id, dataset_id, metric_ids, judge_model, temperature, judge_temperature (defaults to 0 so re-judging is reproducible; above 0 the same output can score differently), max_tokens (cap on generated tokens per row; leave unset for the provider default, set it to match production when your prompt's output is long enough to truncate), output_column (score existing outputs: omit prompt_id and grade a dataset column instead, default actual_output), expected_column (dataset column holding each row's answer key, given to the judge and to checks that compare against the row's expected value, default expected_output)

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"prompt_id": 1, "dataset_id": 1, "metric_ids": [1, 2]}'

GET /api/v1/runs/:id

Get a run with status, progress, response count, and average score.

Also returns: metric_averages, a per-metric breakdown with each metric's average score (pass_rate for checks, plus avg_check_score for a list_overlap check, the average fraction from 0 to 1), the number of rows it graded, and low_count, how many scored below the medium quality threshold

curl https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1 \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/runs/:id/generate

Start generating responses. Returns 202 Accepted. Poll the run to check progress. Returns 422 with the reason when the run cannot start, for example when no configured provider serves the prompt's model or the judge model.

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1/generate \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/runs/:id/retry_failures

Re-queue responses that failed during generation. Returns 202 Accepted, or 409 Conflict if the judge version has drifted since the run executed (use /rerun instead to avoid mixing versions in one run).

Optional: only (array of failed response IDs, to retry just a subset)

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1/retry_failures \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/runs/:id/rerun

Clone the run and start generating responses on the copy against the current prompt and metric versions. Returns the new run with 202 Accepted. Useful for capturing a fresh baseline after metric edits.

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1/rerun \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/runs/:id/regrade

Re-judge the existing successful responses against the current metric versions without regenerating model output. Returns 202 Accepted, or 422 if no responses are eligible or no configured provider serves the judge model.

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1/regrade \
  -H "Authorization: Bearer YOUR_TOKEN"

GET /api/v1/runs/:id/compare?with=:other_id

Side-by-side comparison against another run. Returns {left_run_id, right_run_id, metric_ids: [...], rows: [...]} with one row per input case, per-metric scores on both sides, and the delta. A check reports left_passed, right_passed and result_change, and a list_overlap check also reports left_check_score, right_check_score and check_score_delta, so a fraction that moved shows even when the verdict did not. Rows are keyed by the left run's input cases: a case present only in the left run is returned with the right side nulled out, and a case present only in the right run is omitted.

curl "https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1/compare?with=2" \
  -H "Authorization: Bearer YOUR_TOKEN"

PATCH /api/v1/runs/:id

Update a run. Accepts same params as create.

curl -X PATCH https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "baseline v2", "metric_ids": [1, 2, 3]}'

DELETE /api/v1/runs/:id

Delete a run and all its responses. Returns 204 No Content.

Responses

Read-only access to generated responses and their review scores. Nested under runs.

GET /api/v1/runs/:run_id/responses

List responses for a run, including nested review scores.

Optional filters: status (pending, retrying, succeeded, failed), min_score, max_score, sort (id, score_asc, score_desc), plus limit and offset

Trim the payload: fields takes a comma-separated list of response keys and always returns id. Prefix with reviews. to trim each nested review, e.g. fields=score,reviews.metric_name,reviews.ai_score

curl "https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1/responses?sort=score_asc&limit=10&fields=id,score,reviews.metric_name,reviews.ai_score" \
  -H "Authorization: Bearer YOUR_TOKEN"

GET /api/v1/runs/:run_id/responses/:id

Get a single response with its review scores and feedback.

Datasets

Data used as input for runs.

GET /api/v1/datasets

List all datasets. Supports pagination (limit, offset) and tag[] filtering.

POST /api/v1/datasets

Create a dataset from inline CSV or an uploaded CSV file.

Required: name, and either csv_data (inline CSV) or a multipart file (CSV upload, preferred for large datasets)

First row is the header. Two column names are recognized specially: expected_output is each row's answer key (ground truth) given to the judge and to checks that compare against the row's expected value, and actual_output is a pre-made output to score in a prompt-less run. Both are overridable per run via expected_column and output_column.

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/datasets \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "tickets", "csv_data": "text,expected_output\\nHello,Hi"}'
curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/datasets \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "name=tickets" \
  -F "file=@tickets.csv"

GET PATCH DELETE /api/v1/datasets/:id

Get, update, or delete a dataset.

curl -X PATCH https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/datasets/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "tickets-q3"}'

Metrics

Scoring dimensions used by the judge model.

GET /api/v1/metrics

List all metrics. Supports pagination (limit, offset) and tag[] filtering.

POST /api/v1/metrics

Create a metric. Defaults to an LLM judge; pass metric_type check with a check_config for a deterministic check that runs with no model and no cost.

Required: name Optional: metric_type (llm_judge default, or check), instruction and rubric_bands (array of {stars, description}) for judges, check_config (check_kind, target, plus per-kind keys) for checks

Check kinds: contains, not_contains, equals (value); regex (pattern); valid_json; json_path_equals (json_path, expected); length_bounds and numeric_bounds (min and/or max); list_overlap (value, score_by, min); numeric_equals (value, tolerance)

Case: A check with no case_sensitive matches case-insensitively, regex and list_overlap included. Send "case_sensitive": true to match case exactly. Before 0.29.0 a regex check read a missing case_sensitive as case-sensitive.

Grading against the answer key: set compare_to to expected on contains, not_contains, equals, json_path_equals, list_overlap or numeric_equals to grade each row against its own expected_output rather than a constant. Drop value (or expected, on json_path_equals) and add expected_path to name the field to read out of a JSON answer key. A target_path, an expected_path and a json_path all walk array indices, as in items.0.name, and may start at the root with $., as in $.items.0.name. A target_path sent with no target sets target to json_path, and one sent with any other target is refused.

Scores, not just verdicts: list_overlap grades a list-valued field and stores a fraction on the review as check_score, with score_by one of recall, precision, f1 or jaccard. Its min is the fraction that counts as a pass. numeric_equals takes a tolerance that is a plain number for a fixed amount, or a percentage string such as "2%" for a share of the expected value. Each run averages it per metric as avg_check_score inside metric_averages, so a partial answer has run history and can gate a regression.

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/metrics \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "relevance", "instruction": "Is the response relevant?"}'

GET PATCH DELETE /api/v1/metrics/:id

Get, update, or delete a metric.

curl -X PATCH https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/metrics/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"instruction": "Is the response factually accurate?", "rubric_bands": [{"stars": 5, "description": "fully accurate"}]}'

Agreement loop

Drive metric improvement from disagree-flagged agreements: ask the model to rewrite the instruction and rubric into a new draft version.

POST /api/v1/metrics/:id/suggest_variants

Generate draft metric versions from the current disagreements. Only rubric-style (llm_judge) metrics can suggest variants. Returns 201 with the new draft versions, or 422 if the metric is a check (checks are exact and have no variants to suggest), if no disagreements exist, if no configured provider serves the model, or if the model produced nothing usable.

Optional: count, model

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/metrics/1/suggest_variants \
  -H "Authorization: Bearer YOUR_TOKEN"

Metric versions

Every metric carries a history of versions (the current published one, prior published ones, and any draft suggestions). Reviews and agreements record the version they ran against, so the API can surface stale state and let you revert.

GET /api/v1/metrics/:metric_id/metric_versions

List every version for the metric, newest version_number first.

GET /api/v1/metrics/:metric_id/metric_versions/:id

Get a single version with its instruction and rubric bands (or check_config for checks), state, and source.

POST /api/v1/metrics/:metric_id/metric_versions/:id/publish

Publish the version as current. Works for a draft (promote) or a superseded published version (revert). Copies the version's instruction and rubric (or check_config for checks) back onto the metric.

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/metrics/1/metric_versions/5/publish \
  -H "Authorization: Bearer YOUR_TOKEN"

DELETE /api/v1/metrics/:metric_id/metric_versions/:id

Dismiss a draft version. Returns 204 No Content, or 409 Conflict if the version is published (published versions are immutable history).

Metric Groups

Named groups of metrics you can apply to a run as a set.

GET /api/v1/metric_groups

List all metric groups with their metric IDs. Supports pagination (limit, offset) and tag[] filtering.

POST /api/v1/metric_groups

Create a metric group.

Required: name Optional: description, metric_ids (array), tag_names (array)

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/metric_groups \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "core quality", "metric_ids": [1, 2, 3]}'

GET PATCH DELETE /api/v1/metric_groups/:id

Get, update, or delete a metric group. PATCH with metric_ids replaces all metric associations.

curl -X PATCH https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/metric_groups/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"metric_ids": [4, 5]}'

Agreements

Per-verdict feedback events on a response/metric pair: agree, disagree (with a corrected score and note), or borderline. Agreements capture the metric version that was current when the verdict was cast, which is what drives the trust signal and the "stale" indicators across the rest of the API.

All agreement endpoints require the judge_agreement_enabled configuration (on by default). When it is disabled every agreement action returns 404 with {"error": "Agreement disabled"}.

GET /api/v1/agreements

List agreements across all runs. Supports filtering by any combination of the query params below.

Optional filters: run_id, response_id, metric_id, metric_version_id, created_by, verdict (agree, disagree, or borderline)

curl "https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/agreements?metric_id=1&verdict=disagree" \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/runs/:run_id/responses/:response_id/metrics/:metric_id/agreements

Cast an agreement on a specific response/metric pair. The metric version on the record is set automatically from the run's review. Idempotent per (response, metric, created_by): the first cast creates the agreement (201 Created), and re-casting for the same created_by updates it in place (200 OK) rather than creating a duplicate.

Required: verdict (agree, disagree, or borderline); corrected_score (1–5) is required when verdict is disagree Optional: corrected_score (for agree/borderline), note, created_by (defaults to "api")

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/runs/1/responses/42/metrics/3/agreements \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"verdict": "disagree", "corrected_score": 3, "note": "too generous", "created_by": "alice"}'

GET /api/v1/runs/:run_id/responses/:response_id/metrics/:metric_id/agreements

List agreements scoped to a specific run, response, and metric. It is the nested equivalent of the top-level index filtered by those three ids.

DELETE /api/v1/agreements/:id

Delete an agreement. Returns 204 No Content.

Tags

Domain labels you can attach to metrics, prompts, runs, datasets, and metric groups. Tags are auto-assigned a color from a 10-color palette. Each of those five resources' list endpoints can be filtered by one or more tags using ?tag[]=name query params (OR semantics: a record matching any of the given tags is returned).

GET /api/v1/tags

List all tags with name and color.

curl https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/tags \
  -H "Authorization: Bearer YOUR_TOKEN"

POST /api/v1/tags

Create a tag.

Required: name

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/tags \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "real estate"}'

GET PATCH DELETE /api/v1/tags/:id

Get, update, or delete a tag. PATCH accepts name. DELETE returns 204 No Content and removes all taggings for this tag.

Tagging resources

Metrics, prompts, runs, datasets, and metric groups accept a tag_names array on their create and update endpoints. Passing a name that does not yet exist silently creates the tag. On PATCH, the list replaces all existing tags for that record (omit the field to leave tags unchanged).

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/metrics \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Accuracy", "tag_names": ["real estate"]}'

MCP tools

tags_listList every tag in CompletionKit, in name order. Returns each tag's id, name, color and timestamps. Tags label prompts, datasets, metrics, metric groups and runs. Use this to see which labels exist, or to find a tag's ID before renaming or deleting it.
tags_getGet one tag by ID. Returns its id, name, color and timestamps. Use it to check a tag's current name before you rename it or pass it in tag_names.
tags_createCreate a tag for labelling prompts, datasets, metrics, metric groups and runs. The name is trimmed and lowercased. It may contain only the letters a to z, digits, spaces, hyphens and underscores (accented and non-Latin letters are rejected), can be up to 64 characters, and must not match an existing tag. Color is auto-assigned. Returns the new tag. You don't need this tool before tagging a record, because the create and update tools for those records take tag_names and create missing tags for you.
tags_updateRename a tag. Pass the new name; leaving it out returns an error. The name follows the same rules as tags_create and can't match another tag, because tags are not merged. The new name shows at once on every prompt, dataset, metric, metric group and run that carries the tag. Returns the updated tag.
tags_deleteDelete a tag. Removes the tag from every linked metric, metric group, prompt, run, and dataset; those records themselves are kept. This cannot be undone. Use tags_update instead if you only want to rename it. Returns a confirmation message.

The existing metrics_create, metrics_update, prompts_create, prompts_update, runs_create, runs_update, datasets_create, datasets_create_from_url, datasets_update, metric_groups_create, and metric_groups_update tools all accept a tag_names parameter with the same auto-create and replace semantics as the REST API.

Provider Credentials

LLM provider API keys. The api_key field is write-only and never returned in responses.

GET /api/v1/provider_credentials

List all provider credentials (api_key excluded).

POST /api/v1/provider_credentials

Create a provider credential. Each provider may have only one credential; creating a second for an already-configured provider returns 422.

Required: provider (openai, anthropic, ollama, openrouter, azure_foundry) Optional: api_key (not enforced by the API, but required in practice for hosted providers; local providers like ollama can omit it), api_endpoint (required when provider is azure_foundry), api_version

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/provider_credentials \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"provider": "openai", "api_key": "sk-..."}'
curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/provider_credentials \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"provider": "azure_foundry", "api_key": "...", "api_endpoint": "https://my-resource.openai.azure.com", "api_version": "2024-10-21"}'

GET PATCH DELETE /api/v1/provider_credentials/:id

Get, update, or delete a provider credential. DELETE returns 422 (not 204) when the provider is still in use by prompts or judge runs; remove those references first.

Changing provider or api_endpoint on a credential with a stored key requires api_key in the same request, otherwise PATCH returns 422 and nothing changes. Send "api_key": null to remove the key instead.

curl -X PATCH https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/provider_credentials/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"api_key": "sk-new..."}'

Imports

Bring an existing promptfoo config into CompletionKit in one call. Prompts, the test dataset, and assert-based metrics are created where they map cleanly and skipped with a reason where they don't. Providers are matched against your already-configured credentials; any referenced in the config but not yet configured are reported so you can add them.

POST /api/v1/imports/promptfoo

Import a promptfooconfig.yaml. Send the YAML as a config param, or POST the raw YAML as the request body. Returns 201 with a mapping summary, or 422 if the YAML cannot be parsed.

Request: config (the YAML text) or a raw YAML request body

Response 201: prompts and metrics each list what was created and what was skipped (with a reason); dataset is {created, rows, columns} (or {skipped}); providers is {matched, unmatched} (provider strings from the config)

curl -X POST https://completionkit.com/orgs/your-org-slug-goes-here/api/v1/imports/promptfoo \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/x-yaml" \
  --data-binary @promptfooconfig.yaml

Plan quotas

Each plan includes a monthly allowance of runs and prompt fetches. Usage counts per billing period and resets when the period rolls over. The same allowance applies whether you go through the app, the REST API, or the MCP server. Deleting a run does not return quota: the period counter only moves up, so a deleted-then-recreated run still counts twice.

Pre-check your usage

Both surfaces expose the same read so you can see what's left before starting work: GET /api/v1/usage over REST, or the usage_get MCP tool. Either returns both counters for the current period. Unlimited plans report limit and remaining as null.

GET /api/v1/usage

Read-only. The MCP usage_get tool returns this same body.

{
  "runs":           { "used": 42, "limit": 100, "remaining": 58, "percent_used": 42, "over_limit": false, "blocked": false },
  "prompt_fetches": { "used": 10, "limit": 1000, "remaining": 990, "percent_used": 1, "over_limit": false, "blocked": false },
  "period":         { "start": "2026-07-01T00:00:00Z", "end": "2026-07-31T23:59:59Z", "resets_at": "2026-08-01T00:00:00Z" }
}

Over the limit

Runs are hard-blocked once the run limit is reached (a small grace band is allowed first), surfaced with structured fields on both surfaces. Prompt fetches are never blocked for being over quota: your app depends on them at runtime, so once over the limit they keep serving and only warn (owner email plus a heads-up to your team). We count them so you can see the overage, but we won't brick a live app.

REST 402 Payment Required

POST /api/v1/runs returns 402 once the run allowance is spent. (Prompt fetches never return 402 for being over quota.)

{
  "error": "quota_exceeded",
  "scope": "runs",
  "message": "Run limit reached for this billing period.",
  "used": 100, "limit": 100,
  "resets_at": "2026-08-01T00:00:00Z",
  "upgrade_url": "https://completionkit.com/pricing"
}

MCP runs_create error

The tool result is an error (isError: true) whose structuredContent marks it a hard quota. retryable: false means retrying will not help and will only spend more quota, so an agent should stop and surface the upgrade link rather than loop.

{
  "error": "quota_exceeded",
  "code": "run_limit_reached",
  "scope": "runs",
  "retryable": false,
  "used": 100, "limit": 100,
  "resets_at": "2026-08-01T00:00:00Z",
  "upgrade_url": "https://completionkit.com/pricing"
}

Approaching the limit

Once usage crosses 80% of the run limit, a successful runs_create still succeeds but carries a non-fatal usage_warning in its structuredContent, so an agent can slow down ahead of the block instead of discovering it by hitting it.

{
  "usage_warning": {
    "code": "run_limit_approaching",
    "used": 85, "limit": 100, "remaining": 15,
    "resets_at": "2026-08-01T00:00:00Z"
  }
}

Please confirm