Skip to content
FeedbackDashboard

Download build target output

builds.target_outputs.retrieve(TargetOutputRetrieveParams**kwargs) -> TargetOutputRetrieveResponse
GET/v0/build_target_outputs

Retrieve a method to download an output for a given build target.

If the requested type of output is source, and the requested output method is url, a download link to a tarball of the source files is returned. If the requested output method is git, a Git remote, ref, and access token (if necessary) is returned.

Otherwise, the possible types of outputs are specific to the requested target, and the output method must be url or content. See the documentation for type for more information.

The content output method returns the raw content of the output inline, instead of a download URL, and is only supported for the openapi-* and file types.

ParametersExpand Collapse
build_id: str

Build ID

target: Literal["node", "typescript", "python", 10 more]

SDK language target name

One of the following:
"node"
"typescript"
"python"
"go"
"java"
"kotlin"
"ruby"
"terraform"
"cli"
"php"
"csharp"
"sql"
"openapi"
type: Literal["source", "dist", "wheel", 4 more]
One of the following:
"source"
"dist"
"wheel"
"openapi-with-transforms"
"openapi-with-code-samples"
"openapi-sdk-spec"
"file"
output: Optional[Literal["url", "git", "content"]]

Output format: url (download URL), git (temporary access token), or content (raw content returned inline, only supported for the “openapi-*” and “file” types).

One of the following:
"url"
"git"
"content"
path: Optional[str]

The path of the file to get when used with “type”: “file”.

ReturnsExpand Collapse
One of the following:
class URL:
output: Literal["url"]
target: Target
One of the following:
"node"
"typescript"
"python"
"go"
"java"
"kotlin"
"ruby"
"terraform"
"cli"
"php"
"csharp"
"sql"
"openapi"
type: Literal["source", "dist", "wheel", 4 more]
One of the following:
"source"
"dist"
"wheel"
"openapi-with-transforms"
"openapi-with-code-samples"
"openapi-sdk-spec"
"file"
url: str

URL for direct download

path: Optional[str]

The path of the file, which is only present when using with the type “file” option.

class Git:
token: str

Temporary GitHub access token

output: Literal["git"]
ref: str

Git reference (commit SHA, branch, or tag)

target: Target
One of the following:
"node"
"typescript"
"python"
"go"
"java"
"kotlin"
"ruby"
"terraform"
"cli"
"php"
"csharp"
"sql"
"openapi"
type: Literal["source", "dist", "wheel", 4 more]
One of the following:
"source"
"dist"
"wheel"
"openapi-with-transforms"
"openapi-with-code-samples"
"openapi-sdk-spec"
"file"
url: str

URL to git remote

class Content:
content: str

The raw content of the output

output: Literal["content"]
target: Target
One of the following:
"node"
"typescript"
"python"
"go"
"java"
"kotlin"
"ruby"
"terraform"
"cli"
"php"
"csharp"
"sql"
"openapi"
type: Literal["source", "dist", "wheel", 4 more]
One of the following:
"source"
"dist"
"wheel"
"openapi-with-transforms"
"openapi-with-code-samples"
"openapi-sdk-spec"
"file"
path: Optional[str]

The path of the file, which is only present when using with the type “file” option.

Download build target output

import os
from stainless_v0 import Stainless

client = Stainless(
    api_key=os.environ.get("STAINLESS_API_KEY"),  # This is the default and can be omitted
)
target_output = client.builds.target_outputs.retrieve(
    build_id="build_id",
    target="node",
    type="source",
)
print(target_output)
{
  "output": "url",
  "target": "node",
  "type": "source",
  "url": "url",
  "path": "path"
}
Returns Examples
{
  "output": "url",
  "target": "node",
  "type": "source",
  "url": "url",
  "path": "path"
}