builds.sr.ht API Documentation
Queries
job
@access(scope:JOBS, kind:RO)
Returns information about a specific job.
Returns Job
Argumentsid
- Int!
Example Query
query job($id: Int!) {
job(id: $id) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
jobs
@access(scope:JOBS, kind:RO)
Returns jobs submitted by the authenticated user.
Returns JobCursor!
Argumentscursor
- Cursor
Example Query
query jobs($cursor: Cursor) {
jobs(cursor: $cursor) {
results {
...Job
}
cursor
}
}
me
@access(scope:PROFILE, kind:RO)
Returns the authenticated user.
Returns User!
Example Query
query me {
me {
id
created
updated
canonicalName
username
email
url
location
bio
jobs {
...JobCursor
}
}
}
secrets
@access(scope:SECRETS, kind:RO)
Returns secrets owned by the authenticated user.
Returns SecretCursor!
Argumentscursor
- Cursor
Example Query
query secrets($cursor: Cursor) {
secrets(cursor: $cursor) {
results {
...Secret
}
cursor
}
}
userByID
@access(scope:PROFILE, kind:RO)
Returns a specific user.
Returns User
Argumentsid
- Int!
Example Query
query userByID($id: Int!) {
userByID(id: $id) {
id
created
updated
canonicalName
username
email
url
location
bio
jobs {
...JobCursor
}
}
}
userByName
@access(scope:PROFILE, kind:RO)
Returns User
Argumentsusername
- String!
Example Query
query userByName($username: String!) {
userByName(username: $username) {
id
created
updated
canonicalName
username
email
url
location
bio
jobs {
...JobCursor
}
}
}
userWebhook
Returns details of a user webhook subscription by its ID.
Returns WebhookSubscription
Argumentsid
- Int!
Example Query
query userWebhook($id: Int!) {
userWebhook(id: $id) {
id
events
query
url
client {
...OAuthClient
}
deliveries {
...WebhookDeliveryCursor
}
sample
}
}
userWebhooks
Returns a list of user webhook subscriptions. For clients authenticated with a personal access token, this returns all webhooks configured by all GraphQL clients for your account. For clients authenticated with an OAuth 2.0 access token, this returns only webhooks registered for your client.
Returns WebhookSubscriptionCursor!
Argumentscursor
- Cursor
Example Query
query userWebhooks($cursor: Cursor) {
userWebhooks(cursor: $cursor) {
results {
...WebhookSubscription
}
cursor
}
}
version
Returns API version information.
Returns Version!
Example Query
query version {
version {
major
minor
patch
deprecationDate
settings {
...Settings
}
}
}
webhook
Returns information about the webhook currently being processed. This is not valid during normal queries over HTTP, and will return an error if used outside of a webhook context.
Returns WebhookPayload!
Example Query
query webhook {
webhook {
uuid
event
date
}
}
Mutations
cancel
@access(scope:JOBS, kind:RW)
Cancels a submitted job.
Returns Job
ArgumentsjobId
- Int!
Example Query
query cancel($jobId: Int!) {
cancel(jobId: $jobId) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
claim
Claims a job.
Returns Job
ArgumentsjobId
- Int!
Example Query
query claim($jobId: Int!) {
claim(jobId: $jobId) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
createArtifact
Uploads a build artifact.
Returns Artifact
ArgumentsExample Query
query createArtifact($jobId: Int!, $path: String!, $contents: File!) {
createArtifact(jobId: $jobId, path: $path, contents: $contents) {
id
created
path
size
url
}
}
createGroup
@access(scope:JOBS, kind:RW)
Creates a job group from several pending jobs.
'execute' may be set to false to defer queueing this job. The job group is executed immediately if unspecified.
Returns JobGroup!
ArgumentsjobIds
- [Int]!triggers
- [TriggerInput]execute
- Booleannote
- String
Example Query
query createGroup($jobIds: [Int!]!, $triggers: [TriggerInput!], $execute: Boolean, $note: String) {
createGroup(jobIds: $jobIds, triggers: $triggers, execute: $execute, note: $note) {
id
created
note
owner {
...Entity
}
jobs {
...Job
}
triggers {
...Trigger
}
}
}
createUserWebhook
Creates a new user webhook subscription. When an event from the provided list of events occurs, the 'query' parameter (a GraphQL query) will be evaluated and the results will be sent to the provided URL as the body of an HTTP POST request. The list of events must include at least one event, and no duplicates.
This query is evaluated in the webhook context, such that query { webhook } may be used to access details of the event which trigged the webhook. The query may not make any mutations.
Returns WebhookSubscription!
Argumentsconfig
- UserWebhookInput!
Example Query
query createUserWebhook($config: UserWebhookInput!) {
createUserWebhook(config: $config) {
id
events
query
url
client {
...OAuthClient
}
deliveries {
...WebhookDeliveryCursor
}
sample
}
}
deleteUser
Deletes the authenticated user's account. Internal use only.
Returns Int!
Example Query
query deleteUser {
deleteUser {
}
}
deleteUserWebhook
Deletes a user webhook. Any events already queued may still be delivered after this request completes. Clients authenticated with a personal access token may delete any webhook registered for their account, but authorized OAuth 2.0 clients may only delete their own webhooks. Manually deleting a webhook configured by a third-party client may cause unexpected behavior with the third-party integration.
Returns WebhookSubscription!
Argumentsid
- Int!
Example Query
query deleteUserWebhook($id: Int!) {
deleteUserWebhook(id: $id) {
id
events
query
url
client {
...OAuthClient
}
deliveries {
...WebhookDeliveryCursor
}
sample
}
}
start
@access(scope:JOBS, kind:RW)
Queues a pending job.
Returns Job
ArgumentsjobID
- Int!
Example Query
query start($jobID: Int!) {
start(jobID: $jobID) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
startGroup
@access(scope:JOBS, kind:RW)
Starts a pending job group.
Returns JobGroup
ArgumentsgroupId
- Int!
Example Query
query startGroup($groupId: Int!) {
startGroup(groupId: $groupId) {
id
created
note
owner {
...Entity
}
jobs {
...Job
}
triggers {
...Trigger
}
}
}
submit
@access(scope:JOBS, kind:RW)
Submits a new job to the queue.
'secrets' may be set to false to disable secrets for this build. If unspecified, secrets are enabled if at least one is specified in the manifest and the SECRETS:RO grant is available. Enabling secrets requires the SECRETS:RO grant.
'execute' may be set to false to defer queueing this job. Builds are executed immediately if unspecified.
Returns Job!
Argumentsmanifest
- String!tags
- [String]note
- Stringsecrets
- Booleanexecute
- Booleanvisibility
- Visibility
Example Query
query submit($manifest: String!, $tags: [String!], $note: String, $secrets: Boolean, $execute: Boolean, $visibility: Visibility) {
submit(manifest: $manifest, tags: $tags, note: $note, secrets: $secrets, execute: $execute, visibility: $visibility) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
update
@access(scope:JOBS, kind:RW)
Updates the visibility of a job.
Returns Job
ArgumentsjobId
- Int!visibility
- Visibility!
Example Query
query update($jobId: Int!, $visibility: Visibility!) {
update(jobId: $jobId, visibility: $visibility) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
updateJob
Updates job status.
Returns Job
ArgumentsExample Query
query updateJob($jobId: Int!, $status: JobStatus!) {
updateJob(jobId: $jobId, status: $status) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
updateTask
Updates task status.
Returns Job
ArgumentstaskId
- Int!status
- TaskStatus!
Example Query
query updateTask($taskId: Int!, $status: TaskStatus!) {
updateTask(taskId: $taskId, status: $status) {
id
created
updated
status
manifest
note
tags
visibility
image
runner
owner {
...Entity
}
group {
...JobGroup
}
tasks {
...Task
}
artifacts {
...Artifact
}
log {
...Log
}
secrets {
...Secret
}
}
}
Definitions
AccessKind
Enum ValuesRO
RW
AccessScope
Enum ValuesPROFILE
JOBS
LOGS
SECRETS
Artifact
FieldsBinary
Boolean
The Boolean
scalar type represents true
or false
.
Cursor
EmailTrigger
Fieldscondition
- TriggerCondition!to
- String!cc
- StringinReplyTo
- String
EmailTriggerInput
FieldsEntity
FieldsFile
Float
The Float
scalar type represents signed double-precision fractional values as specified by IEEE 754.
ID
The ID
scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.
Int
The Int
scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
Job
Fieldsid
- Int!created
- Time!updated
- Time!status
- JobStatus!manifest
- String!note
- Stringtags
- [String]!visibility
- Visibility!image
- String!- Name of the build image
runner
- String- Name of the build runner which picked up this job, or null if the job is pending or queued.
owner
- Entity!@access(scope:PROFILE, kind:RO)
group
- JobGrouptasks
- [Task]!artifacts
- [Artifact]!log
- Log@access(scope:LOGS, kind:RO)
- The job's top-level log file, not associated with any tasks
secrets
- [Secret]@access(scope:SECRETS, kind:RO)
- List of secrets available to this job, or null if they were disabled
JobCursor
A cursor for enumerating a list of jobs
If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.
FieldsJobEvent
Fieldsuuid
- String!event
- WebhookEvent!date
- Time!job
- Job!
JobGroup
FieldsJobStatus
Enum ValuesPENDING
QUEUED
RUNNING
SUCCESS
FAILED
TIMEOUT
CANCELLED
Log
FieldsOAuthClient
Fieldsuuid
- String!
PGPKey
FieldsSSHKey
FieldsSecret
FieldsSecretCursor
A cursor for enumerating a list of secrets
If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.
FieldsSecretFile
FieldsSettings
FieldsString
The String
scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
Task
FieldsTaskStatus
Enum ValuesPENDING
RUNNING
SUCCESS
FAILED
SKIPPED
Time
Trigger
Triggers run upon the completion of all of the jobs in a job group. Note that these triggers are distinct from the ones defined by an individual job's build manifest, but are similar in functionality.
Fieldscondition
- TriggerCondition!
TriggerCondition
Enum ValuesSUCCESS
FAILURE
ALWAYS
TriggerInput
Fieldstype
- TriggerType!condition
- TriggerCondition!email
- EmailTriggerInputwebhook
- WebhookTriggerInput
TriggerType
Enum ValuesEMAIL
WEBHOOK
User
FieldsUserWebhookInput
Fieldsurl
- String!events
- [WebhookEvent]!query
- String!
UserWebhookSubscription
Fieldsid
- Int!events
- [WebhookEvent]!query
- String!url
- String!client
- OAuthClientdeliveries
- WebhookDeliveryCursor!sample
- String!
Version
FieldsVisibility
Enum ValuesPUBLIC
UNLISTED
PRIVATE
WebhookDelivery
Fieldsuuid
- String!date
- Time!event
- WebhookEvent!subscription
- WebhookSubscription!requestBody
- String!responseBody
- String- These details are provided only after a response is received from the remote server. If a response is sent whose Content-Type is not text/*, or cannot be decoded as UTF-8, the response body will be null. It will be truncated after 64 KiB.
responseHeaders
- StringresponseStatus
- Int
WebhookDeliveryCursor
A cursor for enumerating a list of webhook deliveries
If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.
Fieldsresults
- [WebhookDelivery]!cursor
- Cursor
WebhookEvent
Enum ValuesJOB_CREATED
JOB_UPDATED
WebhookPayload
Fieldsuuid
- String!event
- WebhookEvent!date
- Time!
WebhookSubscription
Fieldsid
- Int!events
- [WebhookEvent]!query
- String!url
- String!client
- OAuthClient- If this webhook was registered by an authorized OAuth 2.0 client, this field is non-null.
deliveries
- WebhookDeliveryCursor!- All deliveries which have been sent to this webhook.
sample
- String!- Returns a sample payload for this subscription, for testing purposes
WebhookSubscriptionCursor
A cursor for enumerating a list of webhook subscriptions
If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.
Fieldsresults
- [WebhookSubscription]!cursor
- Cursor
WebhookTrigger
Fieldscondition
- TriggerCondition!url
- String!
WebhookTriggerInput
Fieldsurl
- String!
Directives
@access
Decorates fields for which access requires a particular OAuth 2.0 scope with read or write access.
Argumentsscope
- AccessScope!kind
- AccessKind!
@defer
Directs the executor to defer this fragment when the if
argument is true or undefined.
@deprecated
Marks an element of a GraphQL schema as no longer supported.
Argumentsreason
- String- Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).
@include
Directs the executor to include this field or fragment only when the if
argument is true.
if
- Boolean!- Included when true.
@internal
This is used to decorate fields which are for internal use, and are not available to normal API users.
@oneOf
Indicates exactly one field must be supplied and this field must not be null
.
@private
This is used to decorate fields which are only accessible with a personal access token, and are not available to clients using OAuth 2.0 access tokens.
@scopehelp
Used to provide a human-friendly description of an access scope
Argumentsdetails
- String!
@skip
Directs the executor to skip this field or fragment when the if
argument is true.
if
- Boolean!- Skipped when true.
@specifiedBy
Exposes a URL that specifies the behavior of this scalar.
Argumentsurl
- String!- The URL that specifies the behavior of this scalar.
@worker
This used to decorate private resolvers which are only accessible to build workers, and are used to facilitate the build process.