---
title: "Get a link to a task's file"
url: "https://developer-staging.agentsync.io/apis/platform-api/versions/8177e94d-86f2-48a5-8ed6-d5fbcb69f38a/operations/getTaskFile"
---

> Full API specification: https://developer-staging.agentsync.io/apis/platform-api/versions/8177e94d-86f2-48a5-8ed6-d5fbcb69f38a.md

# Get a link to a task's file

`GET` `/v1/tasks/{id}/files/{slot}`

Operation ID: `getTaskFile`

Returns a link to the file that answers one slot of a task your organization reaches, good for ten minutes. The link is presigned: anyone who holds it can download the file until expiresAt, so treat it as a secret, and don't log, store or share it. Ask again for a new link once it expires. A link is issued only after the file's malware scan has found it clean. A task your organization does not reach is answered as one that does not exist, and a slot whose answer the task detail masks, such as a sensitive one, is answered as one with no file.

## Path parameters

- `id` (string, required) - The task's TypeID.
- `slot` (string, required) - The slot's key, as slots[].key on the task.

## Responses

- `200` - The file and a link to it.
- `401` - The request has no bearer token, or the token is malformed, expired or wrongly signed (code token_invalid). Every /v1 path answers this without a valid token, including paths no route serves. The response carries WWW-Authenticate: Bearer.
- `403` - The token is valid but the API will not serve it. The code says why: caller_not_service_account (the token identifies a person; only service account tokens are accepted), caller_claims_missing (the token lacks a usable org_id or service_account_id claim), scope_missing (the token lacks the route's product scope, named in the details entry whose param is "scope"), or role_missing (the service account no longer holds a role at its organization that may call the route).
- `404` - No task with this id is one your organization reaches (code task_not_found), or the task has no file you may download at this slot (code file_not_found): a slot the task does not list, one not answered with a file, or one whose answer the task detail masks.
- `409` - The file's malware scan has not found it clean, so no link is issued. The code says why: file_scan_pending (the scan has not finished; try again after Retry-After seconds when the response carries it) or file_unavailable (the file cannot be downloaded because its scan did not find it clean, and retrying does not help).
- `503` - A platform service this API depends on is unavailable (code service_unavailable).

## OpenAPI definition

```yaml
openapi: 3.1.1
info:
  title: AgentSync Platform API
  version: 0.0.1
servers:
  - url: https://api.{environment}.agentsync.io/platform
    description: AgentSync API gateway
    variables:
      environment:
        default: sandbox
        enum:
          - sandbox
paths:
  /v1/tasks/{id}/files/{slot}:
    get:
      operationId: getTaskFile
      summary: Get a link to a task's file
      description: "Returns a link to the file that answers one slot of a task your
        organization reaches, good for ten minutes. The link is presigned:
        anyone who holds it can download the file until expiresAt, so treat it
        as a secret, and don't log, store or share it. Ask again for a new link
        once it expires. A link is issued only after the file's malware scan has
        found it clean. A task your organization does not reach is answered as
        one that does not exist, and a slot whose answer the task detail masks,
        such as a sensitive one, is answered as one with no file."
      security:
        - oauth2:
            - platform.tasks.read
      parameters:
        - name: id
          in: path
          description: The task's TypeID.
          required: true
          schema:
            $ref: "#/components/schemas/TaskId"
          example: task_01h455vb4pex5vsknk084sn02q
        - name: slot
          in: path
          description: The slot's key, as slots[].key on the task.
          required: true
          schema:
            type: string
          example: errorsAndOmissionsCertificate
      responses:
        "200":
          description: The file and a link to it.
          headers:
            Cache-Control:
              description: no-store. The link is short-lived and must not be cached.
              schema:
                type: string
              example: no-store
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskFileLink"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/TaskFileNotFound"
        "409":
          $ref: "#/components/responses/TaskFileNotClean"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"
security:
  - oauth2:
      - platform.tasks.read
components:
  schemas:
    TaskId:
      type: string
      description: A task's ID, a TypeID with the prefix task.
      pattern: ^task_[0-7][0-9a-hjkmnp-tv-z]{25}$
      example: task_01h455vb4pex5vsknk084sn02q
    TaskFileLink:
      type: object
      description: A file that answers one slot of a task, and a presigned link to it.
      required:
        - url
        - expiresAt
        - file
      properties:
        url:
          type: string
          format: uri
          description: A presigned link to the file, good until expiresAt. Anyone who
            holds it can download the file, so treat it as a secret, and don't
            log, store or share it.
          example: https://files.example.com/task-files/abc123?X-Amz-Signature=redacted
        expiresAt:
          type: string
          format: date-time
          description: When the link stops working, ten minutes after it was issued.
          example: 2026-11-10T17:10:00Z
        file:
          $ref: "#/components/schemas/TaskFile"
          description: The file the link downloads.
      example:
        url: https://files.example.com/task-files/abc123?X-Amz-Signature=redacted
        expiresAt: 2026-11-10T17:10:00Z
        file:
          name: Errors and omissions certificate.pdf
          contentType: application/pdf
          sizeBytes: 421883
          sha256: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
    TaskFile:
      type: object
      description: A file uploaded to answer a slot of a task. The bytes are not part of it.
      required:
        - name
        - contentType
        - sizeBytes
        - sha256
      properties:
        name:
          type: string
          description: The file's name as uploaded.
          example: license.pdf
        contentType:
          type: string
          description: The file's media type.
          example: application/pdf
        sizeBytes:
          type: integer
          format: int64
          description: The file's size in bytes.
          example: 48213
        sha256:
          type: string
          description: The hex SHA-256 of the file's bytes.
          example: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
      example:
        name: license.pdf
        contentType: application/pdf
        sizeBytes: 48213
        sha256: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
    Error:
      type: object
      description: "The canonical error envelope. Every error the API writes carries a
        machine-readable code as the first details entry, the one whose param is
        \"code\"; branch on that, not on the message. There are two exceptions,
        both 500s the service could not build a normal error for: the platform's
        panic recovery writes an empty body, and a failure to encode a response
        writes {\"message\": \"internal server error\"} with no details. Treat a
        500 without a code as internal_error. A 429 from the API gateway, in
        front of the API, carries a message only; treat any 429 as a signal to
        slow down."
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable summary of why the request failed.
          example: invalid page_size
        details:
          type: array
          description: 'The code entry {"param": "code", "message": "<code>"} first, then
            entries that name the offending request parameter. Present on every
            error the service writes except the two code-less 500s described
            above, so it is not marked required.'
          items:
            $ref: "#/components/schemas/ErrorDetail"
      example:
        message: invalid page_size
        details:
          - param: code
            message: parameter_invalid
          - param: page_size
            message: must be a positive integer
    ErrorDetail:
      type: object
      description: "One entry of an error's details: the error code, or a request
        parameter and what is wrong with it."
      required:
        - param
        - message
      properties:
        param:
          type: string
          description: The parameter the entry is about, or "code" for the error code.
          example: code
        message:
          type: string
          description: For param "code", the error code; otherwise what is wrong with the
            parameter.
          example: parameter_invalid
      example:
        param: code
        message: parameter_invalid
  responses:
    Unauthorized:
      description: "The request has no bearer token, or the token is malformed,
        expired or wrongly signed (code token_invalid). Every /v1 path answers
        this without a valid token, including paths no route serves. The
        response carries WWW-Authenticate: Bearer."
      headers:
        WWW-Authenticate:
          description: The authentication scheme the API expects.
          schema:
            type: string
          example: Bearer
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: invalid or missing bearer token
            details:
              - param: code
                message: token_invalid
    Forbidden:
      description: "The token is valid but the API will not serve it. The code says
        why: caller_not_service_account (the token identifies a person; only
        service account tokens are accepted), caller_claims_missing (the token
        lacks a usable org_id or service_account_id claim), scope_missing (the
        token lacks the route's product scope, named in the details entry whose
        param is \"scope\"), or role_missing (the service account no longer
        holds a role at its organization that may call the route)."
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: token lacks the required scope
            details:
              - param: code
                message: scope_missing
              - param: scope
                message: platform.contracts.read
    TaskFileNotFound:
      description: "No task with this id is one your organization reaches (code
        task_not_found), or the task has no file you may download at this slot
        (code file_not_found): a slot the task does not list, one not answered
        with a file, or one whose answer the task detail masks."
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: file not found
            details:
              - param: code
                message: file_not_found
    TaskFileNotClean:
      description: "The file's malware scan has not found it clean, so no link is
        issued. The code says why: file_scan_pending (the scan has not finished;
        try again after Retry-After seconds when the response carries it) or
        file_unavailable (the file cannot be downloaded because its scan did not
        find it clean, and retrying does not help)."
      headers:
        Retry-After:
          description: Seconds to wait before asking again. Present only on
            file_scan_pending.
          schema:
            type: integer
          example: 30
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: the file's malware scan has not finished; try again later
            details:
              - param: code
                message: file_scan_pending
    ServiceUnavailable:
      description: A platform service this API depends on is unavailable (code
        service_unavailable).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
          example:
            message: service unavailable
            details:
              - param: code
                message: service_unavailable
  securitySchemes:
    oauth2:
      type: oauth2
      description: "How to get the access token: the client-credentials flow, with the
        client ID and secret AgentSync issued for your organization. The token
        host follows the environment, auth.<environment>.agentsync.io. Request
        only the scopes your integration needs."
      flows:
        clientCredentials:
          tokenUrl: https://auth.sandbox.agentsync.io/oauth2/token
          scopes:
            platform.organizations.read: Read organizations.
            platform.contracts.read: Read contracts.
            platform.contract-assignments.read: Read contract assignments.
            platform.producers.read: Read producers.
            platform.tasks.read: Read tasks.
            platform.requirement-sets.read: Read requirement sets.
```
