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

# Contents

> Download the data behind a search result

## Notes

* To authenticate, you'll need a [Tako API key](https://developer.tako.com/console/api-keys). It's best practice to store it as an environment variable to avoid hardcoding sensitive credentials in your code.
* Contents downloads the data behind a result returned by [Search](/api-reference/search-v3) or [Answer](/api-reference/answer). Pass the result's URL and Tako returns a short-lived download URL — a CSV of a Tako card's data, or the extracted text of any other web page.
* You don't pass a `format`; Tako detects the right content from the URL and the response reports what it produced.

<Note>
  A result is downloadable when it carries a `content` descriptor in the Search or Answer response. Use that result's URL here — a card's `webpage_url` or a web result's `url`.
</Note>


## OpenAPI

````yaml POST /v1/contents
openapi: 3.1.0
info:
  title: Knowledge Search API
  version: 1.0.0
servers:
  - url: https://tako.com/api/
    description: Tako Production API Server
security: []
paths:
  /v1/contents:
    post:
      tags:
        - tako
      summary: Download content
      description: >-
        Download the content behind a search result: a CSV of a Tako card's
        underlying data, or the full text of a web page. Returns a short-lived
        presigned download URL. Protected-source cards (data export not
        available) return 403.
      operationId: contents
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContentsRequest'
      responses:
        '200':
          description: >-
            Downloadable content for a result: a presigned URL plus format and
            cost metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContentsResponse'
        '400':
          description: Invalid request data (validation or malformed body).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAPIError'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAPIError'
        '403':
          description: >-
            Action not permitted for this resource (e.g. protected-source
            export).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAPIError'
        '404':
          description: The requested resource does not exist or has no exportable data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAPIError'
      security:
        - apiKey: []
components:
  schemas:
    ContentsRequest:
      properties:
        url:
          type: string
          title: Url
          description: >-
            The result URL to fetch downloadable content for (a
            TakoCard.webpage_url or a WebResult.url). A Tako card URL yields a
            CSV of the card's data; any other URL yields the page's extracted
            text.
          examples:
            - https://tako.com/card/abc123
        mode:
          $ref: '#/components/schemas/ContentsDeliveryMode'
          description: >-
            Delivery mode: 'url' (default) returns a presigned download link;
            'inline' returns the content in the response body (CSV capped at
            1000 rows, with total_rows; or web text).
          default: url
      type: object
      required:
        - url
      title: ContentsRequest
      description: >-
        Request body for POST /api/v1/contents.


        The caller passes the result URL it wants downloadable content for; the

        endpoint detects the right content from the URL itself. A Tako card URL

        resolves to a CSV of the card's underlying data; any other URL resolves
        to

        the page's extracted full text. `mode` controls delivery: `url`
        (default)

        returns a presigned download link; `inline` returns the content in the

        response.
    ContentsResponse:
      properties:
        contents:
          items:
            $ref: '#/components/schemas/ContentItem'
          type: array
          title: Contents
        request_id:
          type: string
          title: Request Id
      type: object
      required:
        - request_id
      title: ContentsResponse
      description: >-
        Response for POST /api/v1/contents.


        `contents` is a list so the contract stays stable if a single result
        ever

        yields multiple artifacts; today it always carries exactly one item.
    BaseAPIError:
      properties:
        error_message:
          type: string
          title: Error Message
        error_type:
          $ref: '#/components/schemas/APIErrorType'
      type: object
      required:
        - error_message
        - error_type
      title: BaseAPIError
    ContentsDeliveryMode:
      type: string
      enum:
        - url
        - inline
      title: ContentsDeliveryMode
      description: >-
        How /contents returns the content. URL (default) is the existing

        presigned-download behavior; INLINE returns the content in the response
        body

        (CSV text capped at 1000 rows, or web text) and skips the S3 upload.
    ContentItem:
      properties:
        format:
          $ref: '#/components/schemas/ContentFormat'
        cost:
          type: number
          title: Cost
          default: 0
        data:
          anyOf:
            - type: string
            - type: 'null'
          title: Data
        total_rows:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Rows
        truncated:
          type: boolean
          title: Truncated
          default: false
        source_url:
          type: string
          title: Source Url
          description: The originating result URL that was resolved.
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: Presigned, short-lived URL to download the content.
        expires_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Expires At
          description: ISO-8601 UTC timestamp when `url` expires.
      type: object
      required:
        - format
        - source_url
      title: ContentItem
      description: >-
        A single downloadable artifact.


        Inherits `format` + `cost` + the inline fields (`data`/`total_rows`/

        `truncated`) from ResultContent. URL mode additionally populates

        `url`/`expires_at` (a short-lived presigned download link); INLINE mode

        populates the inherited inline fields and leaves `url`/`expires_at`
        null.
    APIErrorType:
      type: string
      enum:
        - BAD_REQUEST
        - AUTHENTICATION_ERROR
        - INTERNAL_SERVER_ERROR
        - RELEVANT_RESULTS_NOT_FOUND
        - RATE_LIMIT_EXCEEDED
        - PAYMENT_REQUIRED
        - REQUEST_TIMEOUT
        - FORBIDDEN
        - NOT_FOUND
      title: APIErrorType
    ContentFormat:
      type: string
      enum:
        - csv
        - text
      title: ContentFormat
  securitySchemes:
    apiKey:
      type: apiKey
      name: X-API-Key
      in: header

````