> ## 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.

# Artifacts

> SDK methods to register, list, retrieve, and manage artifacts in the TrueFoundry registry.

## Methods

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

  #### Parameters

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

  #### Returns

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

    The artifact 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.artifacts.get(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="delete">
  Delete an artifact 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.artifacts.delete(
      id="id_value",
  )
  ```
</Accordion>

<Accordion title="list">
  List artifacts with optional filtering by FQN, ML Repo, name, or run ID.

  #### Parameters

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

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

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

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

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

  <ParamField body="run_id" type="typing.Optional[str]">
    ID of the run to filter artifacts by
  </ParamField>

  <ParamField body="include_empty_artifacts" type="typing.Optional[bool]">
    Whether to include artifacts that have no versions
  </ParamField>

  #### Returns

  <ResponseField name="SyncPager[Artifact, ListArtifactsResponse]" type="SyncPager[Artifact, ListArtifactsResponse]">
    [🔗 ListArtifactsResponse](/docs/truefoundry_sdk/types#listartifactsresponse)

    List of artifacts 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.artifacts.list(
      fqn="value",
      ml_repo_id="value",
      name="value",
      offset=10,
      limit=10,
      run_id="value",
      include_empty_artifacts="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="create_or_update">
  Create or update an artifact version.

  #### Parameters

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

    Manifest containing metadata for the artifact to apply
  </ParamField>

  #### Returns

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

    The created or updated artifact version
  </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.artifacts.create_or_update(
      manifest={"key": "value"},
  )
  ```
</Accordion>

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

  #### Parameters

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

  #### Returns

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

    Artifact 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.artifacts.get_by_fqn(
      fqn="value",
  )
  ```
</Accordion>
