This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
工作流 REST API
使用 EAS REST API 从你自己的系统触发工作流并检查其状态。
EAS REST API 提供用于触发工作流和读取运行详情的端点。所有端点都位于 https://api.expo.dev 下。请求和响应都是 JSON 格式。
🌐 The EAS REST API exposes endpoints for triggering a workflow and reading run details. All endpoints live under https://api.expo.dev. Requests and responses are JSON.
验证
🌐 Authentication
两个端点都需要 EAS 访问令牌,以承载令牌的形式发送在 Authorization 头中。
🌐 Both endpoints require an EAS access token, sent as a bearer token in the Authorization header.
对于生产集成,请在拥有项目的账户上创建一个机器人用户并赋予其限定角色。然后,该令牌代表机器人用户,而不是个人。你可以撤销它而不影响任何用户。个人访问令牌也适用于一次性脚本。
🌐 For production integrations, create a robot user on the account that owns the project and give it a scoped role. The token then represents the robot user, not a person. You can revoke it without affecting any user. A personal access token also works for one-off scripts.
Authorization: Bearer <EXPO_TOKEN> Content-Type: application/json
触发工作流
🌐 Trigger a workflow
POST /v2/workflows/dispatch
解析给定 Git 引用的工作流文件,根据工作流中声明的 workflow_dispatch 模式验证 inputs,并将一个新的运行加入队列。
🌐 Resolves the workflow file on the given Git ref, validates inputs against the workflow_dispatch schema declared in the workflow, and enqueues a new run.
请求体
🌐 Request body
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
appId | 字符串 (UUID) | 是 | EAS 项目 ID。在项目页面或 app config 的 extra.eas.projectId 中可找到。 |
gitRef | 字符串 | 是 | 分支名称 (main)、标签 (v1.0.0)、提交 SHA,或完全限定的引用 (refs/heads/main, refs/tags/v1.0.0)。 |
fileName | 字符串 | 是 | 工作流文件名,例如 deploy.yml。不要包含 .eas/workflows/ 前缀或其他路径段。 |
inputs | 对象 | 否 | 工作流文件中 on.workflow_dispatch.inputs 下声明的输入值。会根据声明的模式进行验证。 |
响应
🌐 Response
返回 200 OK,包含新的工作流运行 ID 和仪表板中运行的链接:
🌐 Returns 200 OK with the new workflow run ID and a link to the run in the dashboard:
{ "data": { "id": "019d9d17-013a-7e05-89aa-4aa83ff68c32", "url": "https://expo.dev/accounts/acme/projects/example/workflows/019d9d17-013a-7e05-89aa-4aa83ff68c32" } }
示例
🌐 Example
- curl -X POST "https://api.expo.dev/v2/workflows/dispatch" \ -H "Authorization: Bearer $EXPO_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "appId": "a415eac6-231a-4b38-b481-3255a59f13b8", "gitRef": "main", "fileName": "deploy.yml", "inputs": { "environment": "production" } }'错误
🌐 Errors
| 状态 | 原因 |
|---|---|
| 400 | 请求体未通过模式验证,或 inputs 与工作流声明的模式不匹配。 |
| 403 | 令牌无权访问给定的 appId。 |
| 404 | Git 引用在关联的仓库中不存在,或该引用上未找到工作流文件。 |
获取工作流运行
🌐 Get a workflow run
GET /v2/workflows/runs/:workflowRunId
返回工作流运行及其包含的作业。触发运行后,可以使用此端点轮询以获取完成情况,或在自己的用户界面中呈现运行的详细信息。
🌐 Returns the workflow run and the jobs it contains. Use this endpoint to poll for completion after triggering a run, or to render a run's details in your own UI.
响应
🌐 Response
{ "data": { "id": "019d9d17-013a-7e05-89aa-4aa83ff68c32", "status": "in-progress", "url": "https://expo.dev/accounts/acme/projects/example/workflows/019d9d17-013a-7e05-89aa-4aa83ff68c32", "gitCommitHash": "564b61ebdd403d28b5dc616a12ce160b91585b5b", "gitCommitMessage": "Add home screen", "requestedGitRef": "refs/heads/main", "triggerEventType": "MANUAL", "createdAt": "2026-05-22T15:04:11.000Z", "updatedAt": "2026-05-22T15:05:42.000Z", "jobs": [ { "id": "019d9d17-1a3f-7c10-bdee-5f2811a9d6ad", "key": "build_ios", "name": "Build iOS", "type": "build", "status": "in-progress", "requiredJobKeys": [], "environment": "production", "outputs": {}, "errors": [], "buildId": "f9609423-5072-4ea2-a0a5-c345eedf2c2a", "submissionId": null, "createdAt": "2026-05-22T15:04:11.000Z", "updatedAt": "2026-05-22T15:04:42.000Z" } ] } }
运行的 status 是以下之一:
🌐 The run's status is one of:
| 值 | 含义 |
|---|---|
new | 运行已排队,尚未开始。 |
in-progress | 至少有一个作业正在运行。 |
action-required | 运行已暂停,正在等待手动操作,例如审批。 |
success | 运行已完成,并且每个作业都成功。已终止。 |
failure | 运行已完成,但至少有一个作业失败。已终止。 |
canceled | 运行在完成前已被取消。已终止。 |
jobs 中的每个条目都包含其自己的 status,其中之一是:
🌐 Each entry in jobs includes its own status, one of:
| 值 | 含义 |
|---|---|
new | 任务已排队。 |
in-progress | 任务正在运行。 |
action-required | 任务已暂停,等待手动操作,例如审批。 |
pending-cancel | 已请求取消,但任务尚未停止。 |
success | 任务成功。已结束。 |
failure | 任务失败。已结束。 |
canceled | 任务已取消。已结束。 |
skipped | 因为所需的上游任务未成功,任务被跳过。 |
outputs 包含作业使用工作流文件中的 outputs: 设置的任何值。任何引用的机密将在响应中显示为占位符。type: build 类型的作业包括 buildId,而 type: submission 类型的作业包括 submissionId。每个 ID 都链接到底层的 EAS Build 或 EAS Submit 记录。
示例
🌐 Example
将以下内容保存为 shell 脚本(或粘贴到终端)以触发运行并轮询,直到其达到终止状态:
🌐 Save the following as a shell script (or paste into your terminal) to trigger a run and poll until it reaches a terminal status:
RUN_ID=$(curl -s -X POST "https://api.expo.dev/v2/workflows/dispatch" \ -H "Authorization: Bearer $EXPO_TOKEN" \ -H "Content-Type: application/json" \ -d '{"appId":"...","gitRef":"main","fileName":"deploy.yml"}' \ | jq -r '.data.id') while true; do STATUS=$(curl -s "https://api.expo.dev/v2/workflows/runs/$RUN_ID" \ -H "Authorization: Bearer $EXPO_TOKEN" \ | jq -r '.data.status') echo "status: $STATUS" case "$STATUS" in success|failure|canceled) break ;; esac sleep 10 done
错误
🌐 Errors
| 状态 | 原因 |
|---|---|
| 400 | workflowRunId 不是有效的 UUID。 |
| 403 | 该令牌无权访问运行的项目。 |
| 404 | 不存在具有该 ID 的工作流运行。 |
下一步
🌐 Next step
工作流 YAML 文件的参考,包括 workflow_dispatch 触发器和输入模式。