跳转到内容
EN

预留模板构建

POST/sandbox/v1/templates● 支持

请求体

  • namestring可选

    Name of the template. Can include a tag with colon separator (e.g. "my-template" or "my-template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array.

  • tagsarray可选

    Tags to assign to the template build

  • aliasstring可选

    Alias of the template. Deprecated, use name instead.

  • teamIDstring可选

    Identifier of the team

  • cpuCountinteger可选

    Requested virtual CPU count; a positive integer, default 2 for template builds.

  • memoryMBinteger可选

    Requested build memory in MiB; a positive integer, default 1024.

  • minFreeDiskMbinteger可选

    Upstream minimum free disk request in MiB; use the native diskGb field to set the build disk size.

  • diskGbinteger可选
    默认 10

    Build disk size in GiB, a positive safe integer. Defaults to 10; available only on the own face.

返回

202

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

请求示例

curl
curl https://api.deepraxis.com/sandbox/v1/templates \
  -H "X-API-Key: $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"docs-template","cpuCount":2,"memoryMB":1024,"tags":["docs"],"diskGb":10}'
Python
import requests

api_key = "$PRAXIS_API_KEY"

# templateID and buildID come from the preceding create response; replace the example IDs.
resp = requests.request("POST", "https://api.deepraxis.com/sandbox/v1/templates",
    headers={"X-API-Key": api_key},
    json={"name":"docs-template","cpuCount":2,"memoryMB":1024,"tags":["docs"],"diskGb":10},
)
print(resp.status_code, resp.text)
TypeScript
const apiKey = "$PRAXIS_API_KEY";

// templateID and buildID come from the preceding create response; replace the example IDs.
const resp = await fetch("https://api.deepraxis.com/sandbox/v1/templates", { method: "POST",
  headers: { "X-API-Key": apiKey, "Content-Type": "application/json" },
  body: JSON.stringify({"name":"docs-template","cpuCount":2,"memoryMB":1024,"tags":["docs"],"diskGb":10}),
});
console.log(resp.status, await resp.text());

响应示例 202

{
  "templateID": "sbe_a9b9ece1928540ffcfcf",
  "buildID": "sbt_2158874f-2b56-49ee-beeb-f85922f8e362",
  "public": false,
  "names": [
    "docs-template-e9819104"
  ],
  "aliases": [],
  "tags": [
    "docs"
  ]
}

响应

HTTP 202

The build was requested successfully

application/json

名称 类型 说明
templateID string Identifier of the template
buildID string Identifier of the last successful build for given template
public boolean Whether the template is public or only accessible by the team
names array<string> Names of the template
tags array<string> Tags assigned to the template build
aliases array<string> Aliases of the template