Deployments
Deploying compiles the project and publishes it behind a live write API: programs holding a token can then add triples that follow your schema, and query them with SPARQL.
Deploying
Press Deploy in the header of the Deployments tab, next to its title. The button is shown to the owner and editors only.
The first time for a project, Agrafe asks Publish this project? and shows what will go out: the package name and version, the number of files, and the endpoint POST /api/data/<deployment-id>/triples. Deploying uses the files as they are saved right now. Later deploys go straight through.
Then a dialog shows:
| Field | Notes |
|---|---|
| Deployment ID | Identifies the deployment in every URL. |
| Bearer token | Needed to call the API. Copy it now: it is not shown again. You can issue another one later. Shown to the project owner only: an Editor who deploys is told to ask the owner for a token. |
| POST endpoint | The URL to write triples to. |
| Try it | A ready-made curl command that writes one triple. |
Full API reference → opens the API section of the new deployment.
Each Deploy creates a new deployment with its own id and tokens. To publish changes under the same id, use Update instead. A deployment keeps the package’s reasoning profile as of its deploy or last update: its queries and validation do not change when the package’s reasoning line changes later. Deployments made before Agrafe stored the profile keep RDFS without OWL until they are updated. The number of active deployments depends on your plan.
Deploy and Update are refused with Deployment refused: … when the package’s rules cannot be materialized: a rule, key or equivalent to concept depends on itself through an aggregate (sum, min, max, average, count) or a negation (none, all), so every query on the deployment would fail. The message names the rules, keys or concepts involved. The same error shows in the Problems panel as S040. Releases are not checked.
The Deployments tab
Only people who can edit the project see Update; only the owner sees Tokens, + Token and the trash button (see Collaboration). Each deployment is listed with its date, its status (active or not), its version and its size, for example v2 · 184 triples (58 schema · 11 fact · 115 data).
| Button | Action |
|---|---|
| API | Shows the endpoints, the compiled schema and a tester. See below. |
| Tokens | Owner only. Lists the deployment’s tokens. + Token issues a new one, shown once. Revoke disables one for good. |
| Update | Recompiles the deployment from the current files and bumps its version, replacing its schema, rules, shapes and facts. The id, the tokens and the data already written are kept. A deployment is a frozen snapshot: editing the files changes nothing in it until you press Update (the MCP tool get_deployment tells whether it still matches the files). |
| Trash | Owner, or Editor with a Pro plan. Hold to delete the deployment, its tokens included. |
When the deployed package declares exports, the API section ends with an Exports list: one row per file (the sheets of a workbook are one file), with its format and a Download button. Download builds the file from the deployment’s current data, as GET …/exports/<file> does, and is recorded in the audit log under your account. Whoever can open the API section sees the list.
The API
The API section of a deployment lists its endpoints:
| Method | Endpoint | Use |
|---|---|---|
POST | /api/data/<id>/triples | Write triples. |
GET | /api/data/<id>/dolfin-file | Get the deployed schema compiled to JSON: base_iri, concepts (with their properties and types) and inverses, and nothing else. Derived forms are served by /api/data/<id>/form-specs. Needs a token. |
GET | /api/data/<id>/form-specs | Get the deployment’s derived forms as {"specs": [...]}, one per class: the class IRI as target_class, the form’s fields, and capabilities, its capability report. A spec with no unsupported constraint omits the capabilities key. {"specs": []} when the deployment has no shapes. Needs a token. |
GET | /api/data/<id>/client-validation | {"profile", "rules_n3", "shapes_ttl", "tbox_nt"}: what a form needs to apply the package’s rules and checks in the browser before saving: the reasoning profile, the rules (N3), the shapes (Turtle; without the generated rule shapes, whose rules are in rules_n3) and the schema triples (subclass, subproperty, domain, range, inverse, symmetric/transitive) as N-Triples. Needs a deployment token; share links cannot use it. |
GET | /api/data/<id>/graph-origins | {"snapshot_graph": …, "mapped_graphs": [...], "inferred_graph": "urn:agrafe:inferred"}: the graph holding the values declared in the package, and the source graphs built from its mapped data files. Values in those graphs cannot be changed through replace; see below. Values a rule derives appear under inferred_graph in GRAPH ?g and cannot be written. Needs a token. |
POST | /api/data/<id>/explain | {"triple": {"s", "p", "o"}, "k": 0}: proof k (an index, 0 = first, at most 200) of a fact, as on the Why? panel. Answers {"Proof": {…}}, "NotDerivable" or "NoMore". o is {"Iri": …} or {"Literal": {"value", "datatype", "lang"}}; a literal with neither datatype nor lang is matched by its text. 400 for k over 200, 422 for an invalid triple. Needs a token. |
GET | /api/data/<id>/sparql/public?query=… | Run a SPARQL SELECT or ASK query (URL-encoded). Needs a token. |
POST | /api/data/<id>/sparql/public | The same, with the query as the request body. Needs a token. Both take an optional now=<dateTime> in the URL; see SPARQL, and format= / name=, see below. |
GET | /api/data/<id>/validate | Check the data against the package’s conditions; see Validating data. Needs a token. |
POST | /api/data/<id>/validate/triples | Dry run: check the data plus a triples body, writing nothing; see below. Needs a token. |
POST | /api/data/<id>/derive/triples?concept=<class IRI> | The values the package’s rules derive for a form’s computed fields, from the data plus a triples body, writing nothing; see below. Needs a token. |
POST | /api/data/<id>/delta | Edit stored values: remove some triples and add others in one step, checked against the data version you read; see below. Needs a token. |
GET | /api/data/<id>/version | {"version": n}: the current data version, the base_version of a later delta. Needs a token. |
GET | /api/data/<id>/exports | List the package’s declared exports; see below. Needs a token. |
GET | /api/data/<id>/exports/<file> | Build one export file and download it. Optional now=<dateTime>. Needs a token. |
Three routes serve query builders such as Eqlat: GET /api/data/<id>/sparnatural-config.ttl gives the Sparnatural SHACL config, GET /api/data/<id>/prefixes gives the deployment’s namespace prefixes as {name: namespace} JSON, and GET /api/data/<id>/sparnatural-presets lists, for each field whose type is (C with p: = V), the p = V criterion Eqlat pre-fills once C is picked ([{field, end_class, restriction, value, value_class}], full IRIs). They need the deployment token, or no token when the deployment’s project is public. Without either the answer is 401, the same as for an unknown id; 403 comes with another deployment’s token, and 404 for an unknown id only with a valid token.
Every call needs the header Authorization: Bearer <token>. Public in sparql/public means any web origin may call it (CORS *), not that it works without a token. A call answers 401 without a valid one, 403 with another deployment’s token, and 404 for an unknown deployment id (with a valid token; without one it is still 401). SPARQL answers are application/sparql-results+json by default and only see this deployment.
SPARQL results as CSV or XLSX
A SELECT on sparql/public can come back as a file instead of JSON. Set format= in the URL, or send an Accept header; format= wins when both are given.
format= | Accept | Answer |
|---|---|---|
(none) or json | anything else | application/sparql-results+json, unchanged |
csv | text/csv | text/csv; charset=utf-8, UTF-8 with a BOM so Excel reads accents |
xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | an Excel workbook, one sheet results, header row in bold |
One column per projected variable, in the order of the SELECT (for SELECT *, the order the store reports). The header is the variable name, without ?. IRIs are written prefix:name with the query’s own PREFIX lines, then the deployment’s prefixes (those of GET /api/data/<id>/prefixes), else in full; numbers, booleans and dates are typed cells in XLSX; an unbound variable is an empty cell; a blank node is written _:id. All rows are returned.
The answer carries Content-Disposition: attachment; filename="<name>.<ext>": <name> is the name= URL parameter cut to letters, digits, _ and -, or results. For example:
curl -H "Authorization: Bearer $TOKEN" -o books.csv \
"$AGRAFE/api/data/$ID/sparql/public?format=csv&name=books&query=SELECT%20*%20WHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D"
400 for an ASK query with format=csv or xlsx (there is no table), and for any other format= value. A CONSTRUCT stays an error as with JSON.
POST …/triples takes a JSON array of {"s": …, "p": …, "o": …} and writes all of them or none (422 with one error per rejected triple). It accepts a property of one of the package’s concepts with a value of its type, rdf:type of a concept, and rdfs:subClassOf declaring your own subclass (IRI subject, IRI object) of a concept or of another such subclass, declared in the same request or earlier; rdf:type of that subclass is then accepted too, and validation treats its instances as instances of the concept.
An int field takes a JSON integer from −2⁶³ to 2⁶³−1 and stores it as xsd:integer (42 → "42"^^xsd:integer, as the compiled package writes int). A float field takes a JSON integer or a number with a fraction or exponent, and stores it as xsd:double (3 → "3"^^xsd:double, 1.5 → "1.5"^^xsd:double); facts in the package’s .dlf files are xsd:float, and validation accepts both. Nothing is coerced: on an int field, 1.5, 1.0 (JSON keeps the fraction), a numeric string such as "42" and an integer beyond 2⁶³−1 are rejected with 422 (object value for <…> has wrong type (expected Int)), and a numeric string on a float field is rejected the same way. There is no decimal field type. The same rules apply to each member of a list of int or list of float.
A date, time, date_time or duration field takes a JSON string in the lexical form of xsd:date ("2024-05-01"), xsd:time ("13:45:00"), xsd:dateTime ("2024-05-01T13:45:00") or xsd:duration ("P1DT2H"); a timezone (Z, +02:00) and fractional seconds are accepted. Agrafe stores it as that typed literal ("2024-05-01"^^xsd:date). A malformed string is rejected. The seconds are required: "13:45" is not an xsd:time.
A quantity field (has weight: mass, see quantity types) takes {"value": <number>, "unit": "<unit IRI>"}, where the unit is a QUDT unit IRI of the field’s dimension, any unit of it, compound ones included:
[
{"s": "https://example.org/main#rex", "p": "https://example.org/main#weight",
"o": {"value": "3", "unit": "http://qudt.org/vocab/unit/KiloGM"}}
]
value is a JSON number or a numeric string. Agrafe stores "3"^^<http://qudt.org/vocab/unit/KiloGM>, keeping the value and the unit as sent (no conversion), and adds the unit’s QUDT description once (a qudt:Unit, rdfs:Datatype, qudt:conversionMultiplier, qudt:hasDimensionVector, qudt:symbol, qudt:hasQuantityKind) so that SPARQL filters and validation can compare values written in different units. A unit QUDT does not have (such as km/min) is named by an IRI under the project’s base IRI ending in unit/<unit>, as the compiled Turtle of the package writes it; those are accepted too. Units declared with unitdef in the package are not accepted yet. Old https://dolfin.dev/unit/… IRIs (https://dolfin.dev/unit/kg) are still accepted and rewritten to their QUDT IRI. A unit of the wrong dimension, an unknown unit, or another IRI is rejected.
A duration field, and any field of the time dimension, is stored as an xsd:dayTimeDuration: send an xsd:duration string ("PT20M") or a quantity with a time unit ({"value": 20, "unit": "http://qudt.org/vocab/unit/MIN"}), both stored as "PT20M"^^xsd:dayTimeDuration. Months and years ("P1Y") have no fixed length and are rejected.
A field whose range mixes literals and concepts (has x: string or Person, an sh:or / sh:xone in the deployment’s shapes) takes either an IRI string, for a concept member, or {"value": "<lexical form>", "datatype": "<xsd datatype IRI>"} for a literal member, stored as "<lexical form>"^^<datatype>:
[
{"s": "https://example.org/main#rex", "p": "https://example.org/main#x",
"o": {"value": "hello", "datatype": "http://www.w3.org/2001/XMLSchema#string"}}
]
The datatype must be one of the field’s literal members, and the lexical form must be valid for it ("abc" is no xsd:integer). Anything else is rejected with a 422. A plain string on such a field is always an IRI.
Data written before QUDT (literals typed https://dolfin.dev/unit/… and their dq: unit triples) is migrated by the migrate_quantities admin tool, which rewrites them to the QUDT form above and time values to xsd:dayTimeDuration. It is run by the Agrafe operators during maintenance; nothing is needed on your side.
A list of T field (see the grammar reference) takes its members as a JSON array, in order, each of type T:
[
{"s": "https://example.org/main#r1", "p": "https://example.org/main#stops", "o": ["a", "b"]},
{"s": "https://example.org/main#r2", "p": "https://example.org/main#stops", "o": ["a", "b"]}
]
Agrafe stores it as an rdf:List (rdf:first / rdf:rest, ending in rdf:nil; [] is rdf:nil), as a list written in .dlf facts, so two instances whose list keys hold the same members in the same order are owl:sameAs in SPARQL and in validation. The list cells are named urn:dolfin:list:… after the subject, the property and the members, so sending the same list again adds nothing. The value may also be the IRI of a list node the deployment already has (rdf:nil, or a node with rdf:first, such as cells written as .dlf facts); any other string, or an array member of the wrong type, is rejected.
A successful write answers 201 with {"written": n, "graph": "<IRI>"}: n counts the triples you sent, and graph is the named graph they went to, by default the deployment’s data graph urn:graph:deployment:<id>:data.
Writing a batch as its own source
To keep track of where a batch came from (a file, an import, another system), send the triples with a source object:
{
"triples": [
{"s": "https://example.org/data/book1", "p": "https://example.org/main#title", "o": "Dune"}
],
"source": {
"derived_from": "https://example.org/exports/books.csv",
"label": "Books export",
"agent": "https://example.org/people/alice"
}
}
The triples are then written to a new graph of their own, urn:deployment:<id>/source/<uuid>, returned as graph. Agrafe names it; you cannot choose it. derived_from is required and agent is optional; both must be IRIs. label is optional text of at most 500 characters, and a blank one is ignored. A source with an invalid IRI or too long a label answers 400 and writes nothing.
The new graph is part of the deployment’s data from then on: SPARQL and validation see its triples like any other, and GRAPH <its IRI> { … } reads it alone. Agrafe also records its provenance with PROV-O: prov:wasDerivedFrom the derived_from IRI, prov:generatedAtTime the time of the write (xsd:dateTime), prov:wasAttributedTo the agent if given, and rdfs:label the label if given. These are kept in the deployment’s internal manifest, not in its data, so SPARQL queries do not see them. The triples, the graph and its provenance are written together or not at all.
The plain array form keeps writing to the data graph.
Replacing stored values
To edit an existing instance, add replace, a list of {"s": …, "p": …} pairs, to the {"triples": …} body (with or without source):
{
"triples": [
{"s": "https://example.org/data/book1", "p": "https://example.org/main#title", "o": "Dune Messiah"}
],
"replace": [{"s": "https://example.org/data/book1", "p": "https://example.org/main#title"}]
}
Before the triples are written, every stored value of each pair is removed, in the same step: from the data graph and from the source graphs written through the API. Pending submissions are not touched. A pair with no new triple removes its values. A list value goes with the cells only it uses; a cell that another value also reaches (a shared list tail) stays.
Each s must be a subject of the batch, s and p must be IRIs, p must not be the inverse direction of a property (name the attached one), and there are at most 1000 pairs; otherwise the answer is 400 and nothing is written. When a pair has a value declared in the package (.dlf facts) or built from a mapped data file, the answer is 409 and nothing is written: change it there instead. GET …/graph-origins names those graphs. POST …/validate/triples takes the same replace, so the dry run checks the data as it would be after the edit, with the same 400 and 409.
Listing and deleting source graphs
GET /api/data/<id>/sources lists the deployment’s source graphs with their provenance, oldest first (by generated_at):
{
"sources": [
{
"graph": "urn:deployment:<id>/source/3f2c…",
"derived_from": "https://example.org/exports/books.csv",
"generated_at": "2026-11-01T09:30:00.000Z",
"agent": "https://example.org/people/alice",
"label": "Books export",
"triples": 42
}
]
}
agent and label appear only when the batch gave them. triples counts the quads of the graph, so a list of T value counts its list cells too, as written does.
DELETE /api/data/<id>/sources/<uuid> deletes one, naming it by the last part of its graph IRI (the uuid after /source/), to undo a bad import:
{"deleted": "urn:deployment:<id>/source/3f2c…", "removed": 42}
removed is the number of quads that were in the graph. The graph’s triples, the graph itself, its provenance and its entry in the deployment’s manifest are deleted together or not at all, and SPARQL and validation stop seeing them at once. A uuid that is not one of this deployment’s source graphs (already deleted, or another deployment’s) answers 404; something that is not a uuid answers 400. Only source graphs can be deleted this way: the deployment’s snapshot and data graphs cannot. Both calls take the deployment token, like the other calls; the token is issued to the deployment’s owner and has no narrower scope, so whoever holds it can delete sources. Each delete is recorded in the audit log.
Reviewing pending submissions
Submissions through a share link with quarantine on are stored as pending graphs (see Submitting a form). They are not queried until the owner reviews them. These calls take the deployment token, like /sources:
GET /api/data/<id>/pendinglists them as{"pending": [...]}, oldest first. Each entry has the same fields as a/sourcesentry, plus a content summary:subjects(distinct subjects) andtypes(distinctrdf:typeIRIs, sorted, at most 20). SPARQL cannot read pending graphs, so each entry also carries the submitted values indata: an array of{"subject", "predicate", "object"}, sorted by subject then predicate, at most 200 per graph. When a graph has more,truncatedistrueand the rest is still stored and approved with it.objectis one of{"Iri": "…"},{"StringLiteral": "…"},{"IntLiteral": 3},{"FloatLiteral": 1.5},{"BoolLiteral": true},{"TypedLiteral": ["<lexical>", "<datatype IRI>"]}(dates, times, durations, and quantities, whose datatype is the unit IRI) or{"List": [...]}: alist ofvalue comes back as its members in order, and therdf:Listcells themselves are not listed. The server-generatedqudt:triples describing a quantity’s unit are listed too.POST /api/data/<id>/pending/<uuid>/approveapproves one. Its graph becomes a source graph, listed by/sourcesand seen by SPARQL and validation at once. Its triples and provenance are kept as they are:generated_atstays the submission time. Answers{"approved": 1}.DELETE /api/data/<id>/pending/<uuid>rejects one. Its graph, its triples and its provenance are deleted, asDELETE /sources/<uuid>deletes a source. Answers{"rejected": 1, "removed": <quads>}.POST /api/data/<id>/pending/approveandPOST /api/data/<id>/pending/rejectdo the same for many, with body{"ids": ["<uuid>", ...]}(at most 500 ids). A batch is all or nothing: if one id is not pending, nothing is approved or rejected and the call answers404naming that graph.
The <uuid> is the last part of the graph IRI. An id that is not pending in this deployment answers 404. That includes an approved source, so these calls never delete live data. Something that is not a uuid answers 400. Each approval and rejection is recorded in the audit log.
Mapped data files
The output of each mapping block is a source graph too, one per mapped data file, not part of the snapshot graph. Its derived_from is the file, urn:dolfin:project:<project id>/file/<path> with ?version=<version> when package.dlf has a version (for example urn:dolfin:project:…/file/data/Airport.csv?version=0.1.0), and its label is the file’s path. These graphs are listed by GET /sources with the others. Every deploy and Update replaces them in one step: a re-mapped file’s graph is swapped for a new one (new uuid, no window without its data, no duplicates), and a file that is no longer mapped loses its graph. Sources written through POST /triples are never touched. Deleting a mapped file’s graph by hand only lasts until the next Update.
It also shows each concept with its properties, their type and whether they are required, an example request, and a Try it form: paste a token, fill in a subject, a predicate and a value, and Send writes that triple.
To explore the deployed data interactively, use the SPARQL tab.
Exports
A package can declare files to export with export (see the syntax reference). The declarations are taken from the deployed package: editing the project changes nothing until you press Update, which picks up new, changed and removed exports.
GET …/exports lists them, one entry per declaration (each sheet of a workbook is its own entry):
[
{"file": "out/people.csv", "sheet": null, "format": "CSV", "query": "people"},
{"file": "book.xlsx", "sheet": "People", "format": "XLSX", "query": "inline"}
]
query is the name of the query the export reads, or "inline" for a from: block. A deployment made before exports existed lists []; update it to get its exports.
GET …/exports/<file> builds <file> (as listed, slashes included) on the spot, against everything SPARQL sees: facts, mapped files, data written through the API and the rules. now=<dateTime> pins the clock of the rules, as on SPARQL and …/validate; a malformed value answers 400. The answer has the file’s Content-Type (text/csv; charset=utf-8, the XLSX type or application/json) and Content-Disposition: attachment; filename="<last part of the path>". A path the deployment does not declare answers 404; an export that cannot be built (a value its cast refuses, for instance) answers 422 with the reason. Tokens work as for the other calls (401, 403, 404).
curl -H "Authorization: Bearer $TOKEN" -OJ "$AGRAFE/api/data/$ID/exports/out/people.csv?now=2026-01-01T00:00:00Z"
Audit log. An export usually carries personal data out of Agrafe, so every successful download is recorded in the audit log (ExportDownloaded) with the deployment, the file path and the id of the token used (or, from the Deployments tab, the user). Neither the token nor its hash is recorded. Refused calls (401, 403, 404) and failed builds are not recorded. Keep this log in mind for your GDPR records: it tells who took which file and when.
Dry-run validation
POST …/validate/triples takes the same body as POST …/triples and answers the validation report of the stored data plus those triples, as if they had been written. Nothing is written: no triple, no count, no audit entry. Use it to check a form before submitting it.
The body is read exactly as …/triples reads it, so a request accepted there is accepted here. A source object is accepted and ignored. A triple that …/triples would reject gives the same 422 with one error per rejected triple, and no report. now= and format=turtle (or Accept: text/turtle) work as on …/validate.
The answer is the …/validate JSON, {conforms, results, skipped, warnings}. Each result has focus_node, the instance at fault, and path, its property, so a client can attach the message to the matching field. Both are in N-Triples form: an IRI is written <…>, so strip the brackets to compare it with your subject and predicate. For a Book whose title is one string, sending only its rdf:type:
{
"conforms": false,
"results": [{
"focus_node": "<https://example.org/data/book1>",
"path": "<https://example.org/main#title>",
"component": "MinCountConstraintComponent",
"severity": "Violation",
"message": "…",
"concept": "Book",
…
}],
"skipped": [],
"warnings": []
}
Adding {"s": "https://example.org/data/book1", "p": "https://example.org/main#title", "o": "Dune"} to the same request gives "conforms": true. The cardinality rules themselves are in the language reference.
Computed fields
A form field whose property a rule concludes is a computed field: at deploy, its entry in GET …/form-specs gets "editable": "computed". Formol shows it read-only and fills it in from the rules while the form is being filled in. Deployments made before this change get the marker when they are deployed again.
POST …/derive/triples?concept=<class IRI> takes the same body as …/validate/triples (source ignored, replace honoured) and answers, for the subject of the body’s first rdf:type triple, the values the rules derive for that concept’s computed fields: a JSON array of {s, p, o}, at most 200, the same shape as the triple of …/explain. Nothing is written. A body without an rdf:type triple answers 422; a concept with no computed field answers [].
POST …/explain also takes the draft: its body may carry triples and replace as …/validate/triples does, and the proof is then built over the stored data plus those triples. This is how a form explains a computed value that only exists in the draft.
Editing with a delta
POST …/delta changes stored data in one step:
{
"base_version": 4,
"delete": [{"s": "https://example.org/data/book1", "p": "https://example.org/main#title", "o": "Dune"}],
"insert": [{"s": "https://example.org/data/book1", "p": "https://example.org/main#title", "o": "Emma"}]
}
Both arrays take the triples of a …/triples body and are checked the same way. Either may be empty or left out. version is accepted in place of base_version. A source field is refused with 400: a delta’s inserts always go to the data graph. A third array, delete_subjects, lists instance IRIs to delete whole: every value they have in the data graph and in source batches, with their list cells. Triples where the instance is the object (references to it from other instances) are kept. If the package requires that reference (a one/some field, or any typed reference: the target must keep its type), the check below refuses the delete with 422, naming the referring instance; delete or change the reference in the same delta’s delete/insert.
- Version. Every write to the deployment’s data adds 1 to its data version:
…/triples, a delta, deleting or approving a source, a reload of the mapped data files, and a redeploy.…/triplesanswers it asversion, andGET …/versiongives it. Send the version you read the values at asbase_version. If the data changed since, the answer is409{"conflict": true, "current_version": 5, "base_version": 4, "conflicts": [{"subject": "…", "predicate": "…"}]}and nothing is written: read the values again and retry.conflictsnames each subject and predicate the delta touches whose stored values are no longer exactly the ones it deletes (an insert-only predicate: no longer empty). Send every stored value of a predicate you change indeleteso this test is exact. Eachdelete_subjectsentry is always listed, with"predicate": null. An empty list means only other data changed. - What a delete removes. Exactly the stored triple, in the data graph or in a source batch written through the API (with
source). A triple that is not stored is ignored. A value declared in the package, coming from a mapped data file or waiting in a pending batch of a share link cannot be deleted: that triple gets a per-triple error (below), even when a copy of it is also in the data graph, and even whenbase_versionis stale. An instance indelete_subjectswith any such value is refused whole ("set": "delete_subjects"): approve or reject the pending batch first. A deleted list value also removes its list cells. Inserts always go to the deployment’s data graph. - Check. The data as it would be after the delta is validated with the package’s rules. A delta that adds a
Violationis refused with422{"report": {…}}, the…/validatebody with only the new violations inresults. Violations already in the data, warnings and infos do not block. This is the rule of every API write gate, stricter than the plain…/validateconforms, which also counts violations already stored. Deleting a required value is such a violation. - Per-triple errors. A malformed triple is
422{"errors": [{"index": 0, "message": "…"}], "set": "insert"}, wheresetnames the array (delete,insertordelete_subjects) thatindexpoints into. Tell the two422answers apart by their key:errorsorreport. - Success is
200{"version": 5, "deleted": 1, "inserted": 1, "graph": "…"}. A delta that changes nothing answers the current version with0and0, and does not change it.
Form share links
A share link lets a Formol form be opened without an Agrafe account. Creating one does not open anything yet: the public form pages that accept a share link come later, and the link grants nothing else. It is a different credential from the deployment token: a share token starts with dls_, a deployment token with dlf_live_, and neither is accepted where the other is expected.
These calls are made as yourself, with an OAuth access token carrying the forms:share scope, not with the deployment token. Only the project’s owner and its Editors with a Pro plan (those who may edit the project) can use them. For an Editor without Pro, a Viewer, someone the project is not shared with, or a deployment that does not exist, they answer 404.
POST /api/deployments/<id>/share-links creates a link:
{
"allowed_concepts": ["Answer"],
"expires_at": "2026-12-31T23:59:59Z",
"max_submissions": 100,
"quarantine": true,
"public_reference_concepts": ["Country"]
}
allowed_concepts lists the concepts the form may create, by name or IRI, and must not be empty. expires_at (in the future) and max_submissions (at least 1) are optional. quarantine defaults to false. public_reference_concepts lists the concepts whose instances the form may show in its reference fields. It defaults to empty, and then those fields are hidden. For a Dolfin deployment, every concept must exist in the deployed schema. A bad body answers 400. The 201 answer is {"token": "dls_…", "link": {…}}. The token is shown only this once: Agrafe keeps only its SHA-256 hash.
GET /api/deployments/<id>/share-links lists the deployment’s links, newest first, revoked ones included. A link has id, deployment_id, allowed_concepts, expires_at, max_submissions, submission_count, quarantine, public_reference_concepts, revoked_at, created_by and created_at. The list never includes the token or its hash.
DELETE /api/deployments/<id>/share-links/<link id> revokes a link and answers 204. Revoking a link that is already revoked also answers 204, and its first revoked_at is kept. A link id that does not belong to this deployment answers 404. Each create and each revoke is recorded in the audit log, with the link id but never the token.
GET /api/forms/<share token> is the public side of a link: it needs no login and no Authorization header, and any web page may call it (CORS is open). It answers 200 with the form layout of the link’s allowed concepts only: for each one its name, iri, form (title, display property, fields), the properties those fields use, and its variants if it is a one of: concept. A reference field is kept only if its target is an allowed concept or in public_reference_concepts; such targets that are not allowed are listed under references with just their name, iri and variants. The answer also carries quarantine, and nothing about the project, the deployment or any other concept. A token that is malformed, unknown, revoked, expired or at its max_submissions, or whose deployment no longer exists, always gets the same 404, so tokens can’t be probed.
GET /api/forms/<share token>/instances/<concept> lists the instances a reference field can pick from. <concept> is a name or IRI (URL-encoded) of a concept in the link’s public_reference_concepts; being in allowed_concepts is not enough. It needs no login and answers 200 with up to 200 entries {"iri": …, "label": …}, sorted by label, and nothing else about the instances. The label is the value of the concept’s display property (see Forms in the language reference), or the last segment of the IRI when there is none. Any other concept, and every refusal of the token above, gets the same 404.
Submitting a form
POST /api/forms/<share token>/submit adds one form submission. Like the two calls above, it needs no login and any web page may call it. The body holds form values, not triples:
{
"concept": "Book",
"values": {
"title": "Dune",
"author": ["https://example.org/people/ann", {"nested": 1}],
"genre": "https://example.org/schema#Genre_Fiction"
},
"nested": [
{"concept": "Person", "values": {"name": "Frank"}}
]
}
concept is one of the link’s allowed_concepts, by name or IRI. values maps a field’s property name to its value, written as /triples takes it: a string, number or boolean, {"value", "unit"} for a quantity, {"value", "datatype"} for a literal member of a mixed union, or an array for a list of field. An array on any other field gives one value per member. nested holds “create new” instances, each of an allowed concept. A reference value is one of these:
- the IRI of an existing instance of an allowed concept or of a
public_reference_conceptsconcept; - a variant IRI of a
one of:concept; {"nested": i}, thei-th instance minted in this submission:0is the submitted instance itself, thek-th block ofnested(from 0) isk + 1.
A value for a computed field is never stored: the rules derive it. A submission that carries one is still accepted, without that value (older Formol versions may send it).
POST /api/forms/<share token>/derive takes a submit body and answers what the rules derive for the submitted instance’s computed fields that the public form shows, as …/derive/triples does. Nothing is written or counted, and _hp is ignored. A value for a computed field in the body answers 422. The work shares the server’s budget for anonymous live queries (PUBLIC_LIVE_MAX_CONCURRENT; over it, 503). A derived value can depend on stored data the form does not show (a rule may read referenced instances), so treat the computed fields of a publicly shared form as public.
Agrafe mints the IRI of every new instance (<base>/i/<uuid>) and adds its rdf:type. The client never names a subject, so a submission only ever adds new instances: it never changes an existing one. Only the properties of fields the public form shows are accepted. Any other key gets 422: a property of another concept, rdf:type, or a field hidden because its target is not shared. A reference to any other IRI also gets 422. The submission is then validated like /triples and checked against the SHACL shapes together with the stored data, as the dry run does. A violation on one of the new instances answers 422 with the same report as /validate, plus minted: the IRIs Agrafe minted for this submission, the submitted instance first, then each nested block in order (minted[i] is the instance {"nested": i} names). A client can so tell which block a result’s focus_node is. Problems already in the stored data do not block a submission.
An accepted submission answers 201 with {"instance": "<IRI of the submitted instance>"}. It goes to a new source graph whose only provenance is prov:wasDerivedFrom <urn:share_link:<link id>>. Agrafe records no IP address, account or browser. With quarantine on, the graph is stored as pending: it is listed under neither /sources nor in the SPARQL dataset, so no query sees it until it is reviewed. Each accepted submission counts toward max_submissions. A refused one does not. Once the link is at its cap, the next submission gets the same 404 as a revoked, expired or unknown token. Bodies over 64 KiB answer 413, and more than 50 nested blocks answer 422.
A form may carry a hidden decoy input named _hp (a honeypot) at the top level of the body. People never see it, so they leave it empty; spam bots fill it in. When _hp is a non-empty string, the submission answers 201 with a freshly minted {"instance": …}, exactly like an accepted one, but nothing is stored, it does not count toward max_submissions and it is not in the audit log. An empty _hp is ignored. A dead token still answers 404.
Rate limits
The /api/forms/<share token> calls are rate limited, before the token is even looked up, so a limit tells nothing about whether a token is valid. Over a limit, the answer is 429 with a Retry-After header and the same CORS headers as the other answers, so a browser form can read it. OPTIONS preflights are not counted. The limits are per minute, with bursts up to the same number:
| Limit | Default | Environment variable |
|---|---|---|
All GET and POST from one client IP | 30 | FORMS_RATE_LIMIT_IP_RPM |
All GET and POST on one share token, from any IP | 120 | FORMS_RATE_LIMIT_TOKEN_RPM |
submit from one client IP | 10 | FORMS_RATE_LIMIT_SUBMIT_RPM |
derive from one client IP | 60 | FORMS_RATE_LIMIT_DERIVE_RPM |
derive on one share token, from any IP | 600 | FORMS_RATE_LIMIT_DERIVE_TOKEN_RPM |
derive counts only against its own two limits, never against the other three, so a form that re-derives on every keystroke cannot use up the budget of its reads and submissions.
The client IP is the X-Real-IP header set by the reverse proxy, else the first X-Forwarded-For entry. When Formol shows a share-link form, its server makes these calls and passes the visitor’s IP in X-Real-IP. The Agrafe nginx config trusts that header only on /api/forms/ and only from the Formol server’s own addresses (set_real_ip_from: the host’s public IPv4 and IPv6, and loopback), so the limits count the visitor, not Formol. Any other caller’s X-Real-IP is replaced with its real address. Counters live in the server’s memory: they reset when it restarts, and are not shared between instances.