Shipyard API
API Token
To access your Organization Settings page, click on Settings at the top of your main dashboard:

If you have the Shipyard API enabled for your organization, you can grab its token by going to the Org Settings page and clicking the copy button:

Make sure to include the token as the x-api-token
header with all requests.
Endpoints
List all active environments
URL:
GET https://shipyard.build/api/v1/environment
Arguments (query strings):
Name | Type | Description | Default |
---|---|---|---|
name | string | Filter by environment name | |
org_name | string | Filter by organization name | |
repo_name | string | Filter by repository name | |
branch | string | Filter by branch name | |
pull_request_number | string | Filter by PR number | |
deleted | boolean | Filter by deleted | false |
page | integer | Page number being requested | 1 |
page_size | integer | Number of environments per page | 20 |
- Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' "https://shipyard.build/api/v1/environment?pull_request_number=1112&org_name=shipyardbuild"
- Example response:
- 200 - Data
- 200 - Empty
- 401 - Invalid Token
- JSON
- Metadata
{
"data": [
{
"attributes": {
"bypass_token": "WBwQX4e_sxUgyJhkJFJzcs-oLmYPinVeogPtsJL_SV-7H7QMBN6n3TCbjcYNzRtH",
"name": "muti-repo-app",
"processing": false,
"projects": [
{
"branch": "my-feature-branch",
"commit_hash": "abcabc123123",
"org_name": "shipyard",
"pull_request_number": 1112,
"repo_name": "flask-backend"
},
{
"branch": "master",
"commit_hash": "bcabca321321",
"org_name": "shipyard",
"pull_request_number": null,
"repo_name": "flask-frontend"
}
],
"ready": true,
"retired": false,
"deleted": false,
"stopped": false,
"url": "https://shipyard-multi-repo-app-pr1112.dev.shipyardbuild.shipyard.host"
},
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"links": {
"self": "/api/v1/application/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
},
"type": "application"
}
],
"links": {
"first": "/api/v1/environment?page=1",
"last": "/api/v1/environment?page=10",
"next": "/api/v1/environment?page=2",
"prev": ""
}
}
HTTP/2 200
date: Wed, 20 Apr 2022 14:51:57 GMT
content-type: application/json
content-length: 6382
strict-transport-security: max-age=15724800; includeSubDomains
- JSON
- Metadata
{
"data": [],
"links": {
"first": "/api/v1/environment?page=1",
"last": "/api/v1/environment?page=1",
"next": "",
"prev": ""
}
}
HTTP/2 200
date: Wed, 20 Apr 2022 16:21:42 GMT
content-type: application/json
content-length: 17
strict-transport-security: max-age=15724800; includeSubDomains
- JSON
- Metadata
{
"errors": [
{
"status": 401,
"title": "Invalid token"
}
]
}
HTTP/2 401
date: Wed, 20 Apr 2022 16:16:07 GMT
content-type: application/json
content-length: 87
strict-transport-security: max-age=15724800; includeSubDomains
Get an environment by UUID
URL:
GET https://shipyard.build/api/v1/environment/${app_uuid}
Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' "https://shipyard.build/api/v1/environment/${app_uuid}"
Responses:
Status Code Description 200 Success 404 Environment not found
Get an environment's build history by UUID
URL:
GET https://shipyard.build/api/v1/environment/${app_uuid}/build-history
Arguments (query strings):
Name | Type | Description | Default |
---|---|---|---|
successfully_built | boolean | Only return environments which were deployed successfully | false |
page | integer | Page number being requested | 1 |
page_size | integer | Number of environments per page | 20 |
- Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' "https://shipyard.build/api/v1/environment/${app_uuid}/build-history"
Responses:
Status Code Description 200 Success 404 Environment not found Example response:
- 200 - Data
- 200 - Empty
- 401 - Invalid Token
- 404 - Invalid UUID
- JSON
- Metadata
{
"data": {
"builds": [
{
"id": "111222-ccccc-ddddd-5555",
"projects": [
{
"branch": "my-feature-branch",
"commit_hash": "abcabc123123",
"repo_owner": "shipyard",
"pull_request_number": 1112,
"repo_name": "flask-backend"
},
{
"branch": "master",
"commit_hash": "bcabca321321",
"repo_owner": "shipyard",
"pull_request_number": null,
"repo_name": "flask-frontend"
}
],
"successfully_built": true,
"queued_at": "2022-04-20T20:02:00.039498Z"
},
{
"id": "111222-ccccc-ddddd-214s",
"projects": [
{
"branch": "my-feature-branch",
"commit_hash": "abcabc123567",
"repo_owner": "shipyard",
"pull_request_number": 1112,
"repo_name": "flask-backend"
},
{
"branch": "master",
"commit_hash": "bcabca321321",
"repo_owner": "shipyard",
"pull_request_number": null,
"repo_name": "flask-frontend"
}
],
"successfully_built": false,
"queued_at": "2022-04-19T20:02:00.039498Z"
},
],
"name": "flask-starter-app"
},
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
"links": {
"first": "/api/v1/environment/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/build-history?page=1",
"last": "/api/v1/environment/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/build-history?page=10",
"next": "/api/v1/environment/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/build-history?page=2",
"prev": ""
},
"type": "application"
}
HTTP/2 200
date: Wed, 20 Apr 2022 14:51:57 GMT
content-type: application/json
content-length: 6382
strict-transport-security: max-age=15724800; includeSubDomains
- JSON
- Metadata
{
"data": [],
"id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"links": {
"first": "/api/v1/environment/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/build-history?page=1",
"last": "/api/v1/environment/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/build-history?page=1",
"next": "",
"prev": ""
},
"type": "application"
}
HTTP/2 200
date: Wed, 20 Apr 2022 16:21:42 GMT
content-type: application/json
content-length: 17
strict-transport-security: max-age=15724800; includeSubDomains
- JSON
- Metadata
{
"errors": [
{
"status": 401,
"title": "Invalid token"
}
]
}
HTTP/2 401
date: Wed, 20 Apr 2022 16:16:07 GMT
content-type: application/json
content-length: 87
strict-transport-security: max-age=15724800; includeSubDomains
- JSON
- Metadata
{
"errors": [
{
"status": 404,
"title": "Application not found!"
}
]
}
HTTP/2 404
date: Wed, 20 Apr 2022 16:16:07 GMT
content-type: application/json
content-length: 87
strict-transport-security: max-age=15724800; includeSubDomains
Stop an environment
- URL:
POST https://shipyard.build/api/v1/environment/${app_uuid}/stop
You can only stop a running environment.
- Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' -X POST "https://shipyard.build/api/v1/environment/${app_uuid}/stop"
Responses:
Status Code Description 204 Environment stopped successfully 400 Environment is not running 404 Environment not found
Restart an environment
- URL:
POST https://shipyard.build/api/v1/environment/${app_uuid}/restart
You can only restart retired environments.
- Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' -X POST "https://shipyard.build/api/v1/environment/${app_uuid}/restart"
Responses:
Status Code Description 204 Environment restarted successfully 400 Environment is not retired 404 Environment not found
Rebuild an environment
- URL:
POST https://shipyard.build/api/v1/environment/${app_uuid}/rebuild
You can only rebuild non-deleted environments.
- Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' -X POST "https://shipyard.build/api/v1/environment/${app_uuid}/rebuild"
Responses:
Status Code Description 204 Environment rebuilt successfully 400 Environment is not active 404 Environment not found
Revive an environment
- URL:
POST https://shipyard.build/api/v1/environment/${app_uuid}/revive
You can only revive a deleted environments.
- Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' -X POST "https://shipyard.build/api/v1/environment/${app_uuid}/revive"
Responses:
Status Code Description 204 Environment revived successfully 400 Environment is already active 404 Environment not found
Cancel an environment's latest build
- URL:
POST https://shipyard.build/api/v1/environment/${app_uuid}/cancel
You can only cancel an environment's latest build while it is being built.
- Example cURL:
curl -H 'x-api-token: ${YOUR_API_TOKEN}' -X POST "https://shipyard.build/api/v1/environment/${app_uuid}/cancel"
Responses:
Status Code Description 204 Build cancelled successfully 400 Environment is not active or no builds in-flight 404 Environment not found
Load a snapshot onto an environment
URL:
POST https://shipyard.build/api/v1/environment/${app_uuid}/snapshot-load
Arguments (json):
Name | Type | Description | Default |
---|---|---|---|
sequence_number | integer | Sequence number of desired snapshot to use | |
source_application_id | string (optional) | UUID of source environment, if different from target environment |
- Example cURL:
curl -H "x-api-token: ${YOUR_API_TOKEN}" -H "Content-Type: application/json" -XPOST https://shipyard.build/api/v1/environment/${app_uuid}/snapshot-load --data-raw '{
"data": {
"attributes": {
"sequence_number": 778,
"source_application_id": "000-0fsdf-ljsdfk"
},
"type": "snapshot-load"
}
}'
Responses:
Status Code Description 204 Snapshot load queued 400 Invalid input 404 Environment not found
Change an environment's branches
- URL:
POST https://shipyard.build/api/v1/environment/${app_uuid}
You must declare repo/branch combinations for each existing repo in the environment, even if only one is changed.
- Arguments (json):
Name | Type | Description | Default |
---|---|---|---|
projects | array | Repo-branch updates |
- Example cURL:
curl -H "x-api-token: ${YOUR_API_TOKEN}" -H "Content-Type: application/json" -XPATCH https://shipyard.build/api/v1/environment/${YOUR_API_TOKEN} --data-raw '{
"data": {
"attributes": {
"projects": [
{
"branch": "new-volume",
"repo_name": "react-flask-starter"
},
{
"branch": "master",
"repo_name": "react-starter"
}
]
},
"id": "${app_uuid}",
"type": "application"
}
}'
Responses:
Status Code Description 200 Success, new build queued 400 Invalid input 404 Environment not found