跳转到内容
EN

列出模板(v2)

GET/e2b/v2/templates● 支持

E2B 官方文档 ↗

请求参数

  • teamIDstring可选

    query: Identifier of the team

  • nextTokenstring可选

    query: Cursor to start the list from

  • limitinteger可选
    默认 100

    query: Maximum number of items to return per page

返回

200

错误按 E2B 格式返回,参见 错误码

请求示例

curl
curl https://api.deepraxis.com/e2b/v2/templates \
  -H "X-API-Key: $PRAXIS_API_KEY"
Python
import requests

opts = dict(
    api_key="$PRAXIS_API_KEY",
    api_url="https://api.deepraxis.com/e2b",
    domain="sandbox.praxisusercontent.com",
)

# 官方 SDK 没有封装模板列表,直接用 HTTP 调用
resp = requests.get(
    f"{opts['api_url']}/v2/templates",
    headers={"X-API-Key": opts["api_key"]},
)
print(resp.json())
TypeScript
const opts = {
  apiKey: "$PRAXIS_API_KEY",
  apiUrl: "https://api.deepraxis.com/e2b",
  domain: "sandbox.praxisusercontent.com",
};

// 官方 SDK 没有封装模板列表,直接用 HTTP 调用
const resp = await fetch(`${opts.apiUrl}/v2/templates`, {
  headers: { "X-API-Key": opts.apiKey },
});
console.log(await resp.json());

响应示例 200

[
  {
    "templateID": "node22",
    "buildID": "sbr_base-base_node22@e2ba43b98ce1226ab5242303c33b5f36958784ad06dbc42c0ec439bea6e6dfcb",
    "cpuCount": 1,
    "memoryMB": 1983,
    "diskSizeMB": 24242,
    "public": true,
    "aliases": [],
    "names": [
      "node22"
    ],
    "createdAt": "1970-01-01T00:00:00.000Z",
    "updatedAt": "1970-01-01T00:00:00.000Z",
    "createdBy": null,
    "lastSpawnedAt": null,
    "spawnCount": 0,
    "buildCount": 1,
    "envdVersion": "0.9.0",
    "buildStatus": "ready"
  }
]

响应

HTTP 200

Successfully returned all templates

application/json

名称 类型 说明
[].templateID string Identifier of the template
[].buildID string Identifier of the last successful build for given template
[].cpuCount integer CPU cores for the sandbox
[].memoryMB integer Memory for the sandbox in MiB
[].diskSizeMB integer Disk size for the sandbox in MiB
[].public boolean Whether the template is public or only accessible by the team
[].aliases array<string> Aliases of the template
[].names array<string> Names of the template (namespace/alias format when namespaced)
[].createdAt string Time when the template was created
[].updatedAt string Time when the template was last updated
[].createdBy object
[].createdBy.id string Identifier of the user
[].createdBy.email string Email of the user
[].lastSpawnedAt string Time when the template was last used
[].spawnCount integer Number of times the template was used
[].buildCount integer Number of times the template was built
[].envdVersion string Version of the envd running in the sandbox
[].buildStatus string Status of the template build