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

# Get Artifact Download Url In Experiment

> Get a fetchable URL for the bytes of a binary artifact.

Use this tool when the caller needs the actual content of an image or file
artifact, for example to view a plot logged during an experiment. Tool
results are text, so this returns a URL to fetch rather than the bytes
themselves.

When to Use:
    - Call this after ``list_artifacts_in_experiment`` or
      ``get_artifact_in_experiment`` identifies an artifact whose ``kind`` is
      a media family such as ``image``, rather than ``value`` or
      ``timeseries``.
    - Call this when the user asks to see, open, or download a logged file or
      image.

Constraints:
    - Scalar and timeseries artifacts carry their data in
      ``get_artifact_in_experiment`` already and are rejected here with
      ``422``.
    - Pre-signed URLs expire. Re-call this tool instead of reusing a stale
      URL.

Notes:
    - For artifacts stored inline rather than in object storage, the returned
      URL is a relative API path and ``requires_auth_header`` is true, which
      means it must be fetched with the caller's ``authorization`` header.
    - Surface the URL to the user; do not attempt to inline binary content
      into agent-facing output.

Args:
    experiment_id: Parent experiment identifier.
    artifact_name: Artifact key within experiment metrics.
    user: Authenticated user resolved from the API key.
    db: Active database session.

Returns:
    The artifact name, MIME type, and a URL from which the bytes can be
    fetched.

Raises:
    HTTPException: Raised with ``404`` when the experiment is unavailable to
        the caller or the artifact key is missing, or ``422`` when the
        artifact holds no binary content.



## OpenAPI

````yaml https://api.haiqu.ai/openapi.json get /ai/{experiment_id}/artifact/download_url
openapi: 3.1.0
info:
  title: Haiqu API
  summary: Haiqu RESTful API service.
  description: Cloud service providing the access to Haiqu cloud runtime
  contact:
    name: Haiqu Inc.
    url: https://haiqu.ai/
    email: info@haiqu.ai
  version: 1.5.0
servers: []
security: []
paths:
  /ai/{experiment_id}/artifact/download_url:
    get:
      summary: Get Artifact Download Url In Experiment
      description: >-
        Get a fetchable URL for the bytes of a binary artifact.


        Use this tool when the caller needs the actual content of an image or
        file

        artifact, for example to view a plot logged during an experiment. Tool

        results are text, so this returns a URL to fetch rather than the bytes

        themselves.


        When to Use:
            - Call this after ``list_artifacts_in_experiment`` or
              ``get_artifact_in_experiment`` identifies an artifact whose ``kind`` is
              a media family such as ``image``, rather than ``value`` or
              ``timeseries``.
            - Call this when the user asks to see, open, or download a logged file or
              image.

        Constraints:
            - Scalar and timeseries artifacts carry their data in
              ``get_artifact_in_experiment`` already and are rejected here with
              ``422``.
            - Pre-signed URLs expire. Re-call this tool instead of reusing a stale
              URL.

        Notes:
            - For artifacts stored inline rather than in object storage, the returned
              URL is a relative API path and ``requires_auth_header`` is true, which
              means it must be fetched with the caller's ``authorization`` header.
            - Surface the URL to the user; do not attempt to inline binary content
              into agent-facing output.

        Args:
            experiment_id: Parent experiment identifier.
            artifact_name: Artifact key within experiment metrics.
            user: Authenticated user resolved from the API key.
            db: Active database session.

        Returns:
            The artifact name, MIME type, and a URL from which the bytes can be
            fetched.

        Raises:
            HTTPException: Raised with ``404`` when the experiment is unavailable to
                the caller or the artifact key is missing, or ``422`` when the
                artifact holds no binary content.
      operationId: get_artifact_download_url_in_experiment
      parameters:
        - name: experiment_id
          in: path
          required: true
          schema:
            type: string
            title: Experiment Id
        - name: artifact_name
          in: query
          required: true
          schema:
            type: string
            title: Artifact Name
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextArtifactDownloadModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyQuery: []
        - APIKeyHeader: []
components:
  schemas:
    ContextArtifactDownloadModel:
      properties:
        name:
          type: string
          title: Name
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        download_url:
          type: string
          title: Download Url
        requires_auth_header:
          type: boolean
          title: Requires Auth Header
          default: false
        expires_in_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expires In Seconds
        context:
          type: string
          title: Context
      type: object
      required:
        - name
        - download_url
        - context
      title: ContextArtifactDownloadModel
      description: >-
        Represent a fetchable location for artifact bytes.


        MCP tool results are text, so artifact bytes are never inlined. This
        model

        hands back a URL the caller can fetch directly instead.


        Attributes:
            name: Artifact key within experiment metrics.
            mime_type: MIME type of the stored artifact.
            download_url: Absolute pre-signed URL for S3-backed artifacts, or the
                relative API path for artifacts still stored inline.
            requires_auth_header: Whether ``download_url`` needs the caller's
                ``authorization`` header. Pre-signed URLs do not.
            expires_in_seconds: Lifetime of a pre-signed URL, when applicable.
            context: Guidance on how to use the returned URL.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyQuery:
      type: apiKey
      in: query
      name: HAIQU_API_KEY
    APIKeyHeader:
      type: apiKey
      in: header
      name: authorization

````