Trust a GitHub repository's Actions runs to upload SBOMs (admin)
const url = 'https://example.com/v1/orgs/example/trusted-publishers';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"repository":"example","repository_owner_id":1,"repository_id":1,"workflow":"example","ref_pattern":"example","environment":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/orgs/example/trusted-publishers \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "repository": "example", "repository_owner_id": 1, "repository_id": 1, "workflow": "example", "ref_pattern": "example", "environment": "example" }'Runs of the repository may then call POST /v1/orgs/{org}/sbom-uploads with their OIDC
token instead of an API key. The repository is pinned by GitHub’s numeric IDs,
which survive renames. For a public repository they are looked up on GitHub; for a private
one, send them (gh api repos/OWNER/NAME --jq '.owner.id, .id'). Workflow, ref pattern and
environment are optional restrictions; all that are set must match.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Organization (tenant) slug, e.g. alpenrobotik
Request Bodyrequired
Section titled “Request Bodyrequired”object
Owner/name
Private repositories only
Private repositories only
Workflow file, e.g. release.yml or .github/workflows/release.yml
Glob on the git ref, e.g. refs/tags/v*
GitHub environment the job must run in
Example generated
{ "repository": "example", "repository_owner_id": 1, "repository_id": 1, "workflow": "example", "ref_pattern": "example", "environment": "example"}Responses
Section titled “Responses”Created
object
Owner/name when it was added; matching uses the IDs
E.g. .github/workflows/release.yml; absent: any workflow
E.g. refs/tags/v*; absent: any ref
Absent: any environment, or none
User who added it
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "repository_owner_id": 1, "repository_id": 1, "repository": "example", "workflow": "example", "ref_pattern": "example", "environment": "example", "created_by": "example", "created_at": "2026-04-15T12:00:00Z"}Invalid repository
Caller is not an admin
The same rule exists already
Over the operation’s rate-limit budget (x-affectra-budget): code request.rateLimited with params.budget. Wait Retry-After seconds before trying again.
Every error answer, Content-Type
application/problem+json. The web app and integrations translate code; detail is English,
for people reading curl output or CI logs, and may change wording at
any time. Match on code, never on detail.
object
The HTTP status
Stable error codes. A code is never renamed; new ones may be added, so
a client falls back to detail for a code it doesn’t know. Another
organization’s object answers notFound, the same as a missing one.
What went wrong
Values the code’s message needs, e.g. {“field”: “version”}. Only values the caller sent or may see. Empty when the message needs none.
object
Example
{ "code": "notFound"}Headers
Section titled “Headers”Seconds until a request would be allowed again, at least 1
GitHub could not be reached to look up the repository