> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Artifact Versions

> SDK methods to list, fetch, tag, and manage versions of artifacts stored in TrueFoundry.

## Methods

<Accordion title="apply_tags">
  Apply tags to an artifact version.

  #### Parameters

  <ParamField body="artifact_version_id" type="str" required>
    ID of the artifact version to apply tags to
  </ParamField>

  <ParamField body="tags" type="typing.Sequence[str]" required>
    List of tags to apply to the artifact version
  </ParamField>

  <ParamField body="force" type="typing.Optional[bool]">
    Whether to overwrite existing tags if they conflict
  </ParamField>

  #### Returns

  <ResponseField name="EmptyResponse" type="EmptyResponse">
    [🔗 EmptyResponse](/docs/truefoundry_sdk/types#emptyresponse)

    Empty response indicating successful tag application
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.apply_tags(
      artifact_version_id="value",
      tags="value",
      force="value",
  )
  ```
</Accordion>

<Accordion title="get">
  Get an artifact version by its ID.

  #### Parameters

  <ParamField body="id" type="str" required />

  #### Returns

  <ResponseField name="GetArtifactVersionResponse" type="GetArtifactVersionResponse">
    [🔗 GetArtifactVersionResponse](/docs/truefoundry_sdk/types#getartifactversionresponse)

    The artifact version data
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.get(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="delete">
  Delete an artifact version by its ID.

  #### Parameters

  <ParamField body="id" type="str" required />

  #### Returns

  <ResponseField name="EmptyResponse" type="EmptyResponse">
    [🔗 EmptyResponse](/docs/truefoundry_sdk/types#emptyresponse)

    Empty response indicating successful deletion
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.delete(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="list">
  List artifact versions with optional filtering by tag, FQN, artifact ID, ML Repo, name, version, run IDs, or run steps.

  #### Parameters

  <ParamField body="tag" type="typing.Optional[str]">
    Tag to filter artifact versions by
  </ParamField>

  <ParamField body="fqn" type="typing.Optional[str]">
    Fully qualified name to filter artifact versions by (format: '{artifact_type}:{tenant_name}/{ml_repo_name}/{artifact_name}' or '{artifact_type}:{tenant_name}/{ml_repo_name}/{artifact_name}:{version}')
  </ParamField>

  <ParamField body="artifact_id" type="typing.Optional[str]">
    ID of the artifact to filter versions by
  </ParamField>

  <ParamField body="ml_repo_id" type="typing.Optional[str]">
    ID of the ML Repo to filter artifact versions by
  </ParamField>

  <ParamField body="name" type="typing.Optional[str]">
    Name of the artifact to filter versions by
  </ParamField>

  <ParamField body="version" type="typing.Optional[int]">
    Version number (positive integer) or 'latest' to filter by specific version
  </ParamField>

  <ParamField body="run_ids" type="typing.Optional[typing.Union[str, typing.Sequence[str]]]">
    List of run IDs to filter artifact versions by
  </ParamField>

  <ParamField body="run_steps" type="typing.Optional[typing.Union[int, typing.Sequence[int]]]">
    List of run step numbers to filter artifact versions by
  </ParamField>

  <ParamField body="offset" type="typing.Optional[int]">
    Number of artifact versions to skip for pagination
  </ParamField>

  <ParamField body="limit" type="typing.Optional[int]">
    Maximum number of artifact versions to return
  </ParamField>

  <ParamField body="include_internal_metadata" type="typing.Optional[bool]">
    Whether to include internal metadata in the response
  </ParamField>

  #### Returns

  <ResponseField name="SyncPager[ArtifactVersion, ListArtifactVersionsResponse]" type="SyncPager[ArtifactVersion, ListArtifactVersionsResponse]">
    [🔗 ListArtifactVersionsResponse](/docs/truefoundry_sdk/types#listartifactversionsresponse)

    List of artifact versions matching the query with pagination information
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.list(
      tag="value",
      fqn="value",
      artifact_id="value",
      ml_repo_id="value",
      name="value",
      version="value",
      run_ids="value",
      run_steps="value",
      offset=10,
      limit=10,
      include_internal_metadata="value",
  )

  # Iterate through results
  for item in response:
      print(item.name)

  # Or paginate page by page
  for page in response.iter_pages():
      for item in page:
          print(item.name)
  ```
</Accordion>

<Accordion title="get_signed_urls">
  Get pre-signed URLs for reading or writing files in an artifact version.

  #### Parameters

  <ParamField body="id" type="str" required>
    ID of the artifact version to get signed URLs for
  </ParamField>

  <ParamField body="paths" type="typing.Sequence[str]" required>
    List of relative file paths within the artifact version to get signed URLs for
  </ParamField>

  <ParamField body="operation" type="Operation" required>
    [🔗 Operation](/docs/truefoundry_sdk/enums#operation)

    Operation type for the signed URL (e.g., 'READ' or 'WRITE')
  </ParamField>

  #### Returns

  <ResponseField name="GetSignedUrLsResponse" type="GetSignedUrLsResponse">
    [🔗 GetSignedUrLsResponse](/docs/truefoundry_sdk/types#getsignedurlsresponse)

    List of signed URLs for the requested file paths
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.get_signed_urls(
      id="id_value",
      paths="value",
      operation="value",
  )
  ```
</Accordion>

<Accordion title="create_multi_part_upload">
  Create a multipart upload for large files in an artifact version.

  #### Parameters

  <ParamField body="id" type="str" required>
    ID of the artifact version to upload files to
  </ParamField>

  <ParamField body="path" type="str" required>
    Relative path within the artifact version where the file should be uploaded
  </ParamField>

  <ParamField body="num_parts" type="int" required>
    Number of parts to split the upload into for multipart upload
  </ParamField>

  #### Returns

  <ResponseField name="MultiPartUploadResponse" type="MultiPartUploadResponse">
    [🔗 MultiPartUploadResponse](/docs/truefoundry_sdk/types#multipartuploadresponse)

    Multipart upload information including signed URLs for each part
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.create_multi_part_upload(
      id="id_value",
      path="value",
      num_parts="value",
  )
  ```
</Accordion>

<Accordion title="stage">
  Stage an artifact version for upload, returning storage location and version ID.

  #### Parameters

  <ParamField body="manifest" type="StageArtifactRequestManifest" required>
    [🔗 StageArtifactRequestManifest](/docs/truefoundry_sdk/types#stageartifactrequestmanifest)

    Manifest containing metadata for the artifact to be staged (model or generic artifact)
  </ParamField>

  #### Returns

  <ResponseField name="StageArtifactResponse" type="StageArtifactResponse">
    [🔗 StageArtifactResponse](/docs/truefoundry_sdk/types#stageartifactresponse)

    Staging information including version ID, storage root, and artifact ID
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.stage(
      manifest={"key": "value"},
  )
  ```
</Accordion>

<Accordion title="list_files">
  List files and directories in an artifact version.

  #### Parameters

  <ParamField body="id" type="str" required>
    ID of the artifact version to list files from
  </ParamField>

  <ParamField body="path" type="typing.Optional[str]">
    Relative path within the artifact version to list files from (defaults to root)
  </ParamField>

  <ParamField body="limit" type="typing.Optional[int]">
    Maximum number of files/directories to return
  </ParamField>

  <ParamField body="page_token" type="typing.Optional[str]">
    Token to retrieve the next page of results
  </ParamField>

  #### Returns

  <ResponseField name="SyncPager[FileInfo, ListFilesResponse]" type="SyncPager[FileInfo, ListFilesResponse]">
    [🔗 ListFilesResponse](/docs/truefoundry_sdk/types#listfilesresponse)

    List of files and directories with pagination information
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.list_files(
      id="id_value",
      path="value",
      limit=10,
      page_token="value",
  )
  ```
</Accordion>

<Accordion title="mark_stage_failure">
  Mark a staged artifact version as failed.

  #### Parameters

  <ParamField body="id" type="str" required>
    ID of the staged artifact version to mark as failed
  </ParamField>

  #### Returns

  <ResponseField name="EmptyResponse" type="EmptyResponse">
    [🔗 EmptyResponse](/docs/truefoundry_sdk/types#emptyresponse)

    Empty response indicating successful failure marking
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.mark_stage_failure(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="get_by_fqn">
  Get Artifact Version by FQN.

  #### Parameters

  <ParamField body="fqn" type="str" required>
    FQN of the artifact version
  </ParamField>

  #### Returns

  <ResponseField name="GetArtifactVersionResponse" type="GetArtifactVersionResponse">
    [🔗 GetArtifactVersionResponse](/docs/truefoundry_sdk/types#getartifactversionresponse)

    Artifact version details
  </ResponseField>

  #### Usage

  ```python lines theme={"dark"}
  from truefoundry import TrueFoundry

  client = TrueFoundry(
      api_key="YOUR_API_KEY",
      base_url="https://yourhost.com/path/to/api",
  )

  client.artifact_versions.get_by_fqn(
      fqn="value",
  )
  ```
</Accordion>
