How to use the DORA API to send deployment activity to Span
Last updated: November 12, 2026
Span's DORA API lets your deploy pipeline and incident tooling send deployments, incidents, and services to Span. Span uses them for Deployments / week, Change failure rate, Mean time to recover, and lead time for changes.
Why it matters
Deployments reach Span from any CI tool, including GitHub Actions, GitLab CI/CD, and Azure DevOps, through the DORA API (or a $deploy event). The same API lets you:
Send incidents from other tools, such as PagerDuty or Opsgenie, or record failures your team fixes with a hotfix and never opens an incident for.
Credit deployments to the right teams, either through the pull requests (PRs) each deployment shipped or through services and their owning teams.
How it works
All endpoints live under https://span.app/api/dora/v1 and take and return JSON.
Resource | Endpoints |
|---|---|
Deployments |
|
Incidents |
|
Services |
|
Authentication. Send Authorization: Bearer <token> on every request. Two kinds of token work:
Service account token (recommended for CI): in Span, go to Settings → Service Accounts, open the menu on the service account's row, choose Manage Token, then Generate. Owners and Admins can manage service accounts by default. A service account token keeps working when people change roles or leave.
Personal access token: from Settings → Access Token. It acts as the person who created it, so it stops working if that person leaves.
A missing or invalid token returns 401 Unauthorized. Store tokens as CI secrets, never in workflow files.
Request headers.
X-Request-ID: optional. If you don't set it, Span generates one. Every response includes the request ID in this header.Idempotency-Key: optional, onPOSTandPATCH. Span processes a request with a given key once in 24 hours. A repeat with the same key, token, method, and path returns the original response withX-Replayed-Request: true. Span saves only successful responses, so a failed request can be retried with the same key. Other methods ignore the key.
Timestamps must be ISO-8601 in UTC and end in Z, such as 2026-03-25T18:00:00Z. Offsets like +00:00 return a 400 error.
Pagination. List endpoints use cursor pagination with before, after, and limit query parameters. limit defaults to 10, with a minimum of 1 and a maximum of 100; larger values are rejected. Responses include meta.page with startCursor, endCursor, hasNextPage, and hasPreviousPage. Pass endCursor as after to get the next page.
Processing. A successful call stores the record right away, and it shows in Catalog → Deployments or Catalog → Incidents. DORA metrics, PR links, and team credit are calculated in the background and update in Span's next processing run, which runs about every 3 hours.
Deployments
Field | Required | Description |
|---|---|---|
| Yes | A short name for the deployment. |
| Yes | When the deployment started. Span dates the deployment by this time. |
| No | When the deployment finished. Lead time ends at completion, so send it. |
| No |
|
| No |
|
| No | For example |
| No | Extra context. |
| No | Service slugs. With service-based attribution, Span credits the deployment to the services' owning teams. A slug Span hasn't seen creates a new service with no owner. |
| No |
|
| No |
|
| No | PR numbers shipped in this deployment, for monorepos or partial deploys. Needs a GitHub ( |
| No | An object of extra key-value pairs. Values must be strings. |
curl -X POST https://span.app/api/dora/v1/deployments \
-H "Authorization: Bearer $SPAN_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: deploy-12345" \
-d '{
"title": "billing-api 2fd4e1c",
"triggeredAt": "2026-03-25T18:00:00Z",
"completedAt": "2026-03-25T18:10:00Z",
"type": "deploy",
"status": "success",
"environment": "production",
"version": "2fd4e1c",
"services": ["billing-api"],
"deployer": {"name": "First Last", "email": "first.last@example.com"},
"git": {
"repoUrl": "https://github.com/example/billing-api",
"refName": "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"
},
"pullRequests": [101, 102, 103],
"metadata": {"pipeline": "release"}
}'A successful call returns the deployment in data, including its id, with a meta.cursor. GET /deployments/:id returns the same shape, and GET /deployments returns a page of them.
Update a deployment with PATCH /deployments/:id. Every field is optional. Fields you leave out stay unchanged, and null clears a field that allows it. metadata is merged: keys you send are added or updated, and keys you leave out stay. A common pattern is to post with status: "pending" when a deploy starts, then PATCH it to success or failure with completedAt when it ends.
Delete a deployment with DELETE /deployments/:id. Span returns 204 No Content.
Incidents
Field | Required | Description |
|---|---|---|
| Yes | A short name for the incident. |
| Yes | A whole number, 0 or higher, using your own severity scale. Span stores it; no DORA metric filters on it. |
| Yes | When the incident was declared. Span places the incident in a date range by this time. |
| No, but send it | When the incident started. Mean time to recover runs from here. Without it, the incident adds 0 to MTTR, so send it. |
| No | When the incident was resolved. Until it's set, the incident adds 0 to MTTR, so send it when the incident resolves. |
| No | Total incidents and Change failure rate count an incident when this is blank or contains "prod" or "prd". MTTR counts every environment. |
| No | Teams that own the incident, as |
| No | Service slugs affected by the incident. |
| No | Extra context. |
| No | IDs of deployments that caused or resolved the incident. Span stores them for reference; Change failure rate doesn't use them. |
| No | An object of extra key-value pairs. Values must be strings. |
curl -X POST https://span.app/api/dora/v1/incidents \
-H "Authorization: Bearer $SPAN_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Checkout errors",
"severity": 1,
"issuedAt": "2026-03-25T18:00:00Z",
"startedAt": "2026-03-25T17:45:00Z",
"environment": "production",
"owners": [{"type": "team", "slug": "payments"}]
}'Update an incident with PATCH /incidents/:id, for example to send {"endedAt": "2026-03-25T19:00:00Z", "owners": [{"type": "team", "slug": "payments"}]} when it resolves. Fields you leave out stay unchanged, except owners: a PATCH without owners removes the incident's owning teams, so always send the full owners list. null clears a field that allows it. Delete one with DELETE /incidents/:id (204 No Content).
Services
Field | Required | Description |
|---|---|---|
| Yes | A display name for the service. |
| No | The value you send in a deployment's |
| No | Owning teams, as |
| No | Extra context. |
curl -X POST https://span.app/api/dora/v1/services \
-H "Authorization: Bearer $SPAN_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Billing API", "slug": "billing-api", "owners": [{"type": "team", "slug": "payments"}]}'Update a service with PATCH /services/:id and delete one with DELETE /services/:id. Always include the full owners list when you PATCH a service; a PATCH without owners removes the service's owning teams.
Ownership: connecting deployments and incidents to teams
Span credits each deployment to teams in one of two ways. Your organization uses one or the other.
PR-based attribution (recommended). Span links each deployment to the PRs it shipped and credits the teams of those PRs' authors. Credit follows the people whose work went out, so you don't have to keep service ownership up to date as teams change. It also turns on lead time for changes and PRs per deployment. Span turns this on for your organization on request. Span links PRs in two ways:
Listed: the PR numbers you send in
pullRequests. When present, Span uses these.Inferred: when you don't list PRs, Span takes every PR merged into the repository's default branch after the previous successful deployment to the same repository and environment, up to the PR whose merge commit matches
git.refName. If no merge commit matches, the window ends attriggeredAt. This is why you send the full commit SHA.
For PR-based attribution to work:
Span must sync the repository. Your git integration has to have access to the repository in
git.repoUrl, so its PRs reach Span. For GitHub, that means the Span GitHub App is installed on that repository.The URL must be in a supported form:
https://github.com/owner/repo,https://<name>.ghe.com/owner/repo, orhttps://dev.azure.com/org/project/_git/repo. Deployments from repositories on other hosts can't be linked to PRs.PR authors must be on a team in Span. A deployment whose PRs come only from authors with no team counts in your organization total only.
PRs that haven't synced yet link once they arrive.
Service-based attribution (default). Span credits each deployment to the teams that own the services in its services list. You set service owners through the API. To give an existing or auto-created service an owner, find its id with GET /services (match on slug), then:
curl -X PATCH https://span.app/api/dora/v1/services/<serviceId> \
-H "Authorization: Bearer $SPAN_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"owners": [{"type": "team", "slug": "team-a"}]}'Incidents: in both modes, Span credits each incident to the teams in its owners list.
A deployment or incident with no team still counts in your organization total. "Deployments in the Catalog but not under my team" almost always means the service has no owner (service-based) or the deployment has no linked PRs from team members (PR-based).
Setup
Create a service account token in Settings → Service Accounts and store it as a CI secret.
Ask your Span account team to turn on PR-based attribution, and check that your git integration syncs every repository you deploy from. If you use service-based attribution instead, create each service once with its owning team (
POST /services).Add a step to your production deploy pipeline that has the actual deployment system send
POST /deploymentsafter it knows the production deploy succeeded, rather than sending it at merge time or from an earlier CI step. Includestatus: "success",gitwith the repository URL and the full commit SHA, andservicesif you use them. Add anIdempotency-Keyso retries don't create duplicates.If your incidents don't come from incident.io or Rootly, send them with
POST /incidents, includingstartedAt,owners, and laterendedAt.Check Catalog → Deployments and Catalog → Incidents, then the DORA page under Insights → Productivity → DORA after the next processing run.
Things to know
Status defaults to
pending. Onlysuccessdeployments count. A deployment sent without a status never counts until youPATCHit.For the most accurate DORA metrics, emit deployment events from the system that actually performs the deploy and knows whether it succeeded, rather than at merge time. This avoids counting deploys that later fail or are rolled back. For large-scale rollouts across many repositories, Span recommends a relay pattern such as a Vercel team webhook → relay service; an org-level GitHub webhook → relay service is also a valid option when that better matches your setup.
Production means blank or containing "prod" or "prd". Matching ignores case and checks for the substring, so
productionandPRD-us-east-1count, whilestaging,dev,test, andqadon't. Name non-production environments without "prod" or "prd", for examplestagingrather thanpre-prod.Without an
Idempotency-Key, everyPOSTcreates a new record. A re-run step or automatic retry then counts the same deployment twice. Delete extras withDELETE /deployments/:id.Send the full commit SHA. A short SHA, branch name, or tag in
git.refNamedoesn't match a merge commit, so the inferred window ends attriggeredAtinstead.Inferred linking assumes you deploy the tip of the default branch. Deploying an older commit, or code merged to another branch, gives the wrong PR set. Several services deployed from one repository to the same environment share one PR window, so one service's deploy can claim another's PRs. List PRs in
pullRequestsin those cases.The deployer field doesn't decide team credit. Linked PR authors or service owners do.
Team totals can exceed the organization total. A deployment or incident credited to two teams counts once for each team and once for the organization. Worked example: in March, 10 production deployments each ship PRs from authors on both the payments and checkout teams. Payments shows 10, checkout shows 10, and the organization shows 10. Adding the team rows gives 20, double the real number, so read the organization total instead of summing teams.
Change failure rate is incidents ÷ deployments. Span counts production incidents per production deployment in the same range, so a deployment with several incidents counts each one.
Worked example. In March you send 40 successful production deployments for
billing-api, credited to the payments team, and 2 production incidents withownersset to payments, each withstartedAtandendedAt30 and 90 minutes apart. For March, payments shows about 9.0 deployments per week (40 ÷ 31 days × 7), a change failure rate of 5% (2 ÷ 40), and an average MTTR of 60 minutes.
What each DORA metric needs:
Metric | Needs |
|---|---|
Deployments / week | Production deployments with |
Lead time for changes | Production deployments linked to PRs, which needs PR-based attribution on for your organization |
Change failure rate | Production deployments and production incidents in the same range |
Mean time to recover | Incidents with a start and resolved time ( |
Incidents alone (for example from incident.io) power incident counts and MTTR. Deployments / week, lead time, and change failure rate also need deployments sent through this API or a $deploy event.
Related articles
Send deployments to Span from GitHub Actions or AWS CodePipeline
Lead Time to Production in Span
Mean Time To Recover (MTTR) Report
Need help?
Contact your Span account team or reach out to support@span.app.