Page options
Propose changes to a Biocompile project through the API
Last updated
On this page
The Biocompile API changes a research project the way the AI research assistant does: it proposes the change, and a person decides. You open a workbench for one project, stage changes in it, and submit it. Submitting creates a contribution, which waits for review on the project’s Contributions tab.
A contribution is the reviewed set of changes through which work from a Biocompile conversation reaches a project.
Nothing in the project changes until a person accepts the contribution. Proposing needs
entities:write, and reading workbenches needs entities:read.
Find what you can stage
GET .../action-types lists the kinds of change a workbench accepts, called ActionTypes,
with the input each one takes. GET .../action-types/{action_type_id} returns one. Paths
start with /api/v1/organizations/{organization_id}.
You stage a change as an intent with these fields:
| Field | Meaning |
|---|---|
operation | create, update, supersede, link, delete or unlink |
collection | The kind of record, for example hypotheses or relationships |
target_uri | The record an update, supersede or delete acts on |
payload | The input the ActionType takes |
rationale | Why, shown to the reviewer |
source_refs | The evidence the change rests on |
dependency_change_ids | Staged changes this one needs |
Open a workbench
POST .../workbenches opens a workbench for one project you can change:
curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/workbenches" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{"project_slug": "rp_a7x3", "title": "Import from the March screen"}'
The answer holds the workbench_id and the current revision_id. A workbench belongs to the
person who opened it, and only credentials of the same kind reach it. A personal access token
reaches workbenches your personal access tokens opened, and an app only its own.
Stage changes
POST .../workbenches/{workbench_id}/actions stages one or more intents against the
workbench’s current revision:
curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/workbenches/$WORKBENCH_ID/actions" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: march-screen-batch-1" \
-d '{
"expected_revision_id": "'"$REVISION_ID"'",
"intents": [
{"operation": "create", "collection": "hypotheses",
"payload": {"statement": "MAPK14 inhibition reduces IL-6 release in THP-1 cells."},
"rationale": "Seen in three independent plate runs."}
]
}'
The answer carries the new revision_id, which the next batch is staged against. Each intent
is checked against the project when you stage it. GET .../workbenches/{workbench_id}/changes
shows every staged change with its status: ready, conflict, blocked or unsupported.
Send an Idempotency-Key header to make a retry safe. Repeating a call with the same key
returns the first result and stages nothing new.
Submit for review
POST .../workbenches/{workbench_id}/submit turns the workbench into a contribution:
curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/workbenches/$WORKBENCH_ID/submit" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{"expected_revision_id": "'"$REVISION_ID"'", "title": "Import from the March screen",
"summary": "Three hypotheses from the kinase screen."}'
The answer holds the contribution_id, the status awaiting_approval and a review_url that
opens the contribution in Biocompile. Share it with whoever reviews the project. A submitted
workbench takes no more changes, so open a new one for the next batch.
Who a change is attributed to
Every staged change and the contribution record who made them and that they came through the API:
| Credential | Recorded as |
|---|---|
| Personal access token | You, through your token |
| Service account | The service account |
| AI assistant or partner app | The app, acting for you. The workbench and the contribution belong to you. |
Errors when proposing changes
Proposing changes can fail for reasons the app would also refuse:
| Status | Code | Meaning |
|---|---|---|
| 403 | project_read_only | The project’s change policy is observe only. |
| 404 | not_found | No such project or workbench for you. |
| 409 | workbench_not_editing | The workbench was submitted. Open a new one. |
| 409 | conflict | The revision is stale, an Idempotency-Key was reused, or the changes cannot be submitted. Read the workbench again and retry. |
Common questions
Does submitting a workbench change the project?
No. Submitting creates a contribution that waits for review. The project changes only when a person accepts it.
Can a service account accept its own contribution?
No. Service accounts can propose and read contributions, but only a person decides them.
What happens when two scripts stage into the same workbench?
The second one gets 409 because its expected_revision_id is stale. It reads the workbench
again and retries against the new revision.
Related
Was this page helpful?
Something wrong or missing?