Propose a change through the API
From a script or a CI job, preview a change to a diagram without storing anything, then submit it as a proposal that a person reviews and applies in iyedy.
On this page
A job that derives a diagram from your code, or that keeps it in step with a repository, should not overwrite the diagram. It previews the change, then submits it as a proposal. The proposal waits in iyedy until someone who can edit the diagram applies it or rejects it.
Before you start
- A token with
cartouche.readandcartouche.propose: a personal access token, or a service account for CI. - At least the contributor role in the diagram's workspace. With the viewer role, the routes below store nothing.
- The ids of the organisation, the workspace and the diagram: see Your first API call. In the text below,
Wstands for/v1/t/{tenantId}/w/{workspaceId}.
Propose a change
- Read the diagram and its version
GET /v1/t/{tenantId}/w/{workspaceId}/diagrams/{did}/source HTTP/1.1 Host: app.iyedy.com Authorization: Bearer crt_pat_…The answer gives the diagram's
did,name,classification, its currentversionand its whole definition intext. Keep the version: it is the base of your change. - Prepare the whole definition
Your job edits the definition and keeps it whole. A proposal replaces the whole diagram: what it leaves out is removed.
- Preview the change
POST /v1/t/{tenantId}/w/{workspaceId}/diagrams/{did}/preview HTTP/1.1 Host: app.iyedy.com Authorization: Bearer crt_pat_… Content-Type: application/jsonField Required Value textyes the whole proposed definition baseVersionno the version read in step 1; if the diagram moved on since, the answer is 409 conflictNothing is stored. The answer says whether the change is
valid, with itsdiagnostics(line and message), the line-by-line differences inpatch, the counts and list of elements added, removed and changed inchanges, and infindingsthe check findings before and after, with those the change introduces and resolves. Fix what the diagnostics report and preview again until it is valid. - Submit the proposal
POST /v1/t/{tenantId}/w/{workspaceId}/diagrams/{did}/proposals HTTP/1.1 Host: app.iyedy.com Authorization: Bearer crt_pat_… Content-Type: application/jsonField Required Value textyes the whole proposed definition, as previewed baseVersionno the version the change starts from rationaleno why this change, in a sentence or two, for the reviewer iyedy previews the change again and stores it: the answer is
201with theproposaland itspreview. An invalid change, or one that changes nothing, is422 validation_failedand nothing is stored.In iyedy, the diagram's Assistant panel lists your change under Proposals to review, with your name or the service account's. - Follow it
GET /v1/t/{tenantId}/w/{workspaceId}/diagrams/{did}/proposals?status=open&mine=1 HTTP/1.1 Host: app.iyedy.com Authorization: Bearer crt_pat_…Each proposal has its status (open, accepted, rejected, withdrawn) and says when the diagram moved since it was made. To take back an open proposal of yours, call
POST W/diagrams/{did}/proposals/{pid}/withdraw.
Limits
- A person decides. No token can accept or reject a proposal: that is done in the app. See How proposals reach your team.
- 30 days. A proposal nobody handles expires and is deleted after 30 days.
- Open proposals are capped: 50 per diagram and 10 per author. Over that,
429 rate_limited; handle or withdraw some first. - Recorded without content. In an organisation, each proposal is recorded in the audit log by ids and counts, never with the proposed definition.
If it doesn't work
409 conflict
The diagram changed since the version you sent. Read it again (step 1), apply your change to the new definition, and preview again.
422 validation_failed
The change is not valid, fails a check iyedy runs before storing a proposal, or changes nothing. Read detail: preview again and fix the diagnostics before you submit.
403 permission_denied
The token lacks cartouche.propose, or your role in the workspace is below contributor. See Scopes.
All the codes: Rate limits and errors.
Was this page helpful?Your answer is anonymous and counts only if you accepted measurement.
What went wrong?
Don't write personal data.