Skip to content

REST API ​

Everything you can do in the DepGate web interface, you can do through the REST API. Use it to manage policies as code, automate exception handling, feed the Decision Ledger into other tools, or check packages from a pipeline.

Interactive documentation ​

Every DepGate installation serves its complete, up-to-date API reference (OpenAPI/Swagger) at:

text
https://depgate.example.com/api/docs

You can read every endpoint, request and response there, and try calls directly from the browser.

Authentication ​

Send a token in the Authorization header:

text
Authorization: Bearer <token>
CallerTokenObtained from
A personSession tokenPOST /api/auth/login
A pipelineService-account keyAccess → Service accounts → Add service account
A pipeline jobCI token (download and Package check only, at most 1 day)POST /api/admin/ci-tokens, called with a service-account key

Sign in to get a session token:

bash
curl -sS -X POST https://depgate.example.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"security-team@example.com","password":"…"}'

The response contains token (for API calls, valid for one hour) and registryToken (for package clients). What a token may do follows the account's role: administrative endpoints require the Security role.

Common tasks ​

List policies ​

bash
curl -sS -H "Authorization: Bearer $TOKEN" \
  "https://depgate.example.com/api/admin/policies?limit=20&offset=0"

Create a policy ​

bash
curl -sS -X POST https://depgate.example.com/api/admin/policies \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{
        "name": "Critical vulnerabilities",
        "decision": "BLOCK",
        "mode": "enforce",
        "priority": 10,
        "conditions": { "cvssMin": 9.0 }
      }'

mode is enforce or monitor. conditions holds exactly one rule; see Policy rules → API field names. Add "repositoryIds": ["<id>"] to limit the policy to repositories (IDs from GET /api/admin/repositories).

Enforce a monitoring policy ​

bash
curl -sS -X PUT https://depgate.example.com/api/admin/policies/<id> \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"mode":"enforce"}'

Add an exception ​

bash
curl -sS -X POST https://depgate.example.com/api/admin/exceptions \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{
        "ecosystem": "npm",
        "packageName": "lodash",
        "version": "4.17.20",
        "expiresAt": "2026-12-31T23:59:59Z",
        "reason": "Legacy service pinned; upgrade tracked in SEC-1423"
      }'

Check a package ​

POST /api/package-check returns which versions the gateway would serve. It downloads nothing and never counts as a block. People, service accounts and CI tokens can call it.

bash
curl -sS -X POST https://depgate.example.com/api/package-check \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"ecosystem":"pypi","package":"requests","repository":"default","versions":["2.32.0"]}'
FieldRequiredDescription
ecosystemYesnpm, pypi, go, maven, nuget, cargo, composer or rubygems.
packageYesMaven: groupId:artifactId. Composer: vendor/package.
repositoryNoRepository key. Default default.
versionsNoUp to 20 specific versions to check.
offset, limitNoWindow over versions, newest first. Default 0 and 10, at most 50.

The response contains recommended (the newest allowed stable version, with its license: null when none is declared, absent when it could not be loaded) and versions, each with status (allowed, blocked or unknown), policyName, reasons, releaseType, publishedAt and vulnerabilities. A 429 answer means the rate limit (30 checks per minute) was reached; Retry-After says when to retry.

Read the Decision Ledger and the Audit Log ​

bash
curl -sS -H "Authorization: Bearer $TOKEN" \
  "https://depgate.example.com/api/admin/decision-ledger?limit=100"
curl -sS -H "Authorization: Bearer $TOKEN" \
  "https://depgate.example.com/api/admin/audit-events?feature=policies&limit=100"

Both accept the filters of their pages as query parameters, such as from, to, ecosystem, decision, repository, actor, feature, type and target.

Endpoint groups ​

GroupBase pathPurpose
Auth/api/authSign in, invitations, password reset
Policies/api/admin/policiesCreate, update, delete and reorder policies
Monitoring/api/admin/monitorMonitoring reports, approvals, CSV export
Exceptions/api/admin/exceptionsExceptions
Waiver requests/api/waiver-requestsRequest, approve and reject waivers
Malware/api/admin/malicious-packagesList, sync, override and add entries
Repositories/api/admin/repositoriesRemote and virtual repositories
Namespaces/api/admin/namespacesCheck reserved names, collision check
Users/api/admin/users, /api/admin/service-accountsPeople and service accounts. Lists are paged like the others: limit (1–200), offset, search; the answer is { items, total }
Single sign-on/api/admin/sso-providers, /api/admin/signin-settings, /api/auth/sso, /api/auth/samlIdentity providers, allowed domains, the OIDC and SAML sign-in flows
CI tokens/api/admin/ci-tokensMint (service accounts) and revoke (Security)
Webhooks/api/admin/webhooksWebhooks, deliveries, redelivery
Log streaming/api/admin/stream-destinationsDestinations and test events
Artifact cache/api/artifact-cacheStatus, settings, purge
Jobs/api/admin/jobsQueues, schedules, failed jobs
EPSS/api/admin/epssEPSS data status and sync
Dashboard/api/admin/dashboard/statsDashboard figures
Events/api/admin/decision-ledger, /api/admin/audit-events, /api/admin/job-runs, /api/admin/events/catalogDecision Ledger, Audit Log, job runs, and the list of event types
Package check/api/package-checkVersion check

Errors ​

Errors use standard HTTP status codes with a JSON body:

json
{ "error": "…", "title": "…", "status": 403, "detail": "…" }
StatusMeaning
400The request is invalid. error says why.
401No token, or the token is invalid or expired.
403The token's role may not call this endpoint, or a package is blocked.
404Not found.
409A conflicting operation is running, such as a sync already in progress.
429Rate limited. Wait for Retry-After.

A blocked package download returns 403 with the policy and reasons, and checkUrl, a link to Package check for that version.

Released under the MIT License.