Skip to content

Commit 8ab965f

Browse files
committed
docs: add list deployments endpoint and fix get-latest CORS warning placement
1 parent 5258d83 commit 8ab965f

File tree

4 files changed

+152
-0
lines changed

4 files changed

+152
-0
lines changed

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@
306306
{
307307
"group": "Deployments API",
308308
"pages": [
309+
"management/deployments/list",
309310
"management/deployments/retrieve",
310311
"management/deployments/get-latest",
311312
"management/deployments/promote"

docs/management/deployments/get-latest.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
title: "Get latest deployment"
33
openapi: "v3-openapi GET /api/v1/deployments/latest"
44
---
5+
6+
<Warning>
7+
This endpoint only returns **unmanaged** deployments, which are used in self-hosted setups. It
8+
will return `404` for standard CLI deployments made against Trigger.dev Cloud.
9+
10+
If you're using the CLI to deploy, use the [list deployments](/management/deployments/list) endpoint instead.
11+
</Warning>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: "List deployments"
3+
openapi: "v3-openapi GET /api/v1/deployments"
4+
---

docs/v3-openapi.yaml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,146 @@ paths:
784784
785785
await runs.cancel("run_1234");
786786
787+
"/api/v1/deployments":
788+
get:
789+
operationId: list_deployments_v1
790+
summary: List deployments
791+
description: List deployments for the authenticated environment, ordered by most recent first.
792+
parameters:
793+
- in: query
794+
name: "page[after]"
795+
schema:
796+
type: string
797+
description: The deployment ID to start the search from, to get the next page.
798+
- in: query
799+
name: "page[size]"
800+
schema:
801+
type: integer
802+
minimum: 1
803+
maximum: 100
804+
default: 20
805+
description: The number of deployments to return (default 20, max 100).
806+
- in: query
807+
name: status
808+
schema:
809+
type: string
810+
enum:
811+
[
812+
"PENDING",
813+
"BUILDING",
814+
"DEPLOYING",
815+
"DEPLOYED",
816+
"FAILED",
817+
"CANCELED",
818+
"TIMED_OUT",
819+
]
820+
description: Filter deployments by status.
821+
- in: query
822+
name: period
823+
schema:
824+
type: string
825+
description: Filter deployments created within this period (e.g. 1d, 7d, 3h).
826+
- in: query
827+
name: from
828+
schema:
829+
type: string
830+
description: Filter deployments created on or after this date (ISO 8601).
831+
- in: query
832+
name: to
833+
schema:
834+
type: string
835+
description: Filter deployments created on or before this date (ISO 8601).
836+
responses:
837+
"200":
838+
description: Successful request
839+
content:
840+
application/json:
841+
schema:
842+
type: object
843+
properties:
844+
data:
845+
type: array
846+
items:
847+
type: object
848+
properties:
849+
id:
850+
type: string
851+
description: The deployment ID
852+
createdAt:
853+
type: string
854+
format: date-time
855+
description: When the deployment was created
856+
shortCode:
857+
type: string
858+
description: The short code for the deployment
859+
version:
860+
type: string
861+
description: The deployment version (e.g., "20250228.1")
862+
runtime:
863+
type: string
864+
nullable: true
865+
description: The runtime used (e.g., "node")
866+
runtimeVersion:
867+
type: string
868+
nullable: true
869+
description: The runtime version
870+
status:
871+
type: string
872+
enum:
873+
[
874+
"PENDING",
875+
"BUILDING",
876+
"DEPLOYING",
877+
"DEPLOYED",
878+
"FAILED",
879+
"CANCELED",
880+
"TIMED_OUT",
881+
]
882+
description: The current status of the deployment
883+
deployedAt:
884+
type: string
885+
format: date-time
886+
nullable: true
887+
description: When the deployment was promoted to DEPLOYED
888+
git:
889+
type: object
890+
nullable: true
891+
description: Git metadata associated with the deployment
892+
error:
893+
type: object
894+
nullable: true
895+
description: Error data if the deployment failed
896+
pagination:
897+
type: object
898+
properties:
899+
next:
900+
type: string
901+
nullable: true
902+
description: Cursor for the next page. Pass as `page[after]` to get the next page. Null if there are no more results.
903+
"401":
904+
description: Unauthorized - Access token is missing or invalid
905+
tags:
906+
- deployments
907+
security:
908+
- secretKey: []
909+
x-codeSamples:
910+
- lang: typescript
911+
source: |-
912+
const response = await fetch(
913+
"https://api.trigger.dev/api/v1/deployments",
914+
{
915+
method: "GET",
916+
headers: {
917+
"Authorization": `Bearer ${secretKey}`,
918+
},
919+
}
920+
);
921+
const { data, pagination } = await response.json();
922+
- lang: curl
923+
source: |-
924+
curl -X GET "https://api.trigger.dev/api/v1/deployments" \
925+
-H "Authorization: Bearer tr_dev_1234"
926+
787927
"/api/v1/deployments/{deploymentId}":
788928
parameters:
789929
- in: path

0 commit comments

Comments
 (0)