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

# Retrieves a Source.



## OpenAPI

````yaml /api-reference/openapi.yaml get /sources/{source_id}
openapi: 3.0.3
info:
  title: Totoy API
  description: >-
    Explain documents in simple, plain or detailed language and create Knowledge
    Bases from your documents in 19 languages.
  termsOfService: https://www.totoy.ai
  contact:
    name: Totoy Support
    email: support@totoy.ai
  license:
    name: MIT
    url: https://raw.githubusercontent.com/totoy-ai/totoy-openapi/main/LICENSE
  version: 1.1.5
servers:
  - url: https://api.totoy.ai/v1
security:
  - ApiKeyAuth: []
tags:
  - name: Explanation
    description: >-
      Given a document in any language, an output language and one of three
      language levels, the assistant will return an `Explanation` for this
      document.
  - name: Knowledge Bases
    description: >-
      Create `Knowledge Bases` from document or text `Sources` and chat with an
      assistant about them in 19 languages.
  - name: Sources
    description: >-
      `Sources` are used to upload documents (.pdf, .jpg or .png) or plain texts
      that can be used with features like `Explanation` or `Knowledge Bases.`
  - name: Projects
    description: '`Projects` are used to group `Knowledge Bases` and `Explanations`.'
  - name: Organization
    description: Get information about your `Organization`.
paths:
  /sources/{source_id}:
    get:
      tags:
        - Sources
      summary: Retrieves a Source.
      operationId: getSource
      parameters:
        - $ref: '#/components/parameters/sourceIdParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Source'
              examples:
                document-source-example-1:
                  $ref: '#/components/examples/document-source-example-1'
        4XX:
          $ref: '#/components/responses/general4XXResponse'
        5XX:
          $ref: '#/components/responses/general5XXResponse'
components:
  parameters:
    sourceIdParam:
      name: source_id
      in: path
      required: true
      schema:
        type: string
        maxLength: 29
        pattern: ^src_[a-zA-Z0-9]{25}$
      description: Unique identifier for a `Source` that was uploaded to Totoy.
      examples:
        source-id-example:
          $ref: '#/components/examples/source-id-example'
  schemas:
    Source:
      title: Source
      type: object
      description: >-
        The `Source` object represents a document source (.pdf, .jpg, .png) or
        text source (plain-text) that has been uploaded to Totoy.
      properties:
        source_id:
          description: Unique identifier for the `Source`.
          maxLength: 29
          pattern: ^src_[a-zA-Z0-9]{25}$
          type: string
          example: src_oXiYDg8QOc9JsOk86idRXiywD
        source_type:
          description: Type for this source (document or text).
          type: string
          enum:
            - document
            - text
          example: document
        bytes:
          description: Size of the document file or text, in bytes.
          type: integer
          format: int32
          example: 1234567
        created_at:
          description: Date-time for when the `Source` was created, in ISO 8601 format.
          type: string
          format: date-time
          example: '2024-03-01T00:00:00Z'
        updated_at:
          description: >-
            Date-time for when the `Source` was last modified, in ISO 8601
            format.
          type: string
          format: date-time
          example: '2024-03-01T00:00:00Z'
        title:
          description: Title of the document or text.
          type: string
          maxLength: 512
          example: Totoy Company Overview
        document_file_name:
          description: The file name of a `Source` document.
          type: string
          maxLength: 255
          nullable: true
          example: totoy-company-overview.pdf
        backlink:
          description: >-
            An external url to the `Source` that can be used by clients to link
            back to the original document or text (i.e. a web page containing
            that text).
          type: string
          maxLength: 512
          example: https://www.totoy.ai/totoy-company-overview.pdf
        valid_from:
          description: >-
            From what time the `Source` can be used by a `Knowledge Base` or an
            `Explanation`. If no `valid_from` is set, the `Source` is valid from
            the time it is added to `Sources`.
          type: string
          format: date-time
          nullable: true
          example: '2024-01-01T00:00:00Z'
        valid_until:
          description: >-
            Until when the `Source` can be used by a `Knowledge Base` or an
            `Explanation`. If no `valid_until` is set, the `Source` is valid
            until it is removed from `Sources`.
          type: string
          format: date-time
          nullable: true
          example: '2026-12-31T23:59:59Z'
        project_id:
          description: >-
            The unique identifier of the project this `Source` is assigned to.
            `Sources` can only be used by resources with the same `project_id`.
          maxLength: 28
          pattern: ^pj_[a-zA-Z0-9]{25}$
          type: string
          example: pj_avX7imfLaPcQnv5ckvGlOEBA9
        custom_metadata:
          $ref: '#/components/schemas/CustomMetadata'
        knowledge_base_ids:
          description: List of `Knowledge Base` identifiers where this `Source` is used.
          type: array
          items:
            type: string
            maxLength: 29
            pattern: ^kb_[a-zA-Z0-9]{25}$
            example: kb_feMfJbeqbAEj4u8K5HqmKpUbY
          nullable: true
          example:
            - kb_feMfJbeqbAEj4u8K5HqmKpUbY
            - kb_7eMfJbeqbAEj4u8K5HqmKpUbY
          maxItems: 1500
        status:
          description: >-
            The parsing status of the Document Source. The status `completed`
            indicates that the source is ready for use. The status parameter is
            only available for Document Sources.
          type: string
          enum:
            - in_progress
            - completed
            - failed
          example: in_progress
        pages:
          description: >-
            The number of pages of the Document Source. The pages parameter is
            only available for Document Sources.
          type: integer
          example: 27
      required:
        - source_id
        - source_type
        - bytes
        - created_at
        - updated_at
        - project_id
    CustomMetadata:
      title: CustomMetadata
      description: >-
        Custom optional metadata for a `Source` provided by a client. Up to 10
        key-value pairs.
      type: object
      additionalProperties: true
      maxProperties: 10
      example:
        internal_tag: general_documents
    Problem:
      title: Problem
      description: A Response Body for HTTP Problem Details in RFC 9457 format.
      type: object
      additionalProperties: false
      properties:
        type:
          description: A URI reference that identifies the problem type.
          type: string
          maxLength: 512
          example: https://docs.totoy.ai/probs/out-of-credit
        title:
          description: A short, human-readable summary of the problem type.
          type: string
          maxLength: 512
          example: You do not have enough credit.
        status:
          description: >-
            The HTTP status code generated by the origin server for this
            occurrence of the problem.
          type: integer
          format: int32
          example: 403
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          type: string
          maxLength: 4096
          example: You do not have enough credit to perform this operation.
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          type: string
          maxLength: 512
          example: /projects/pj_avX7imfLaPcQnv5ckvGlOEBA9
  examples:
    document-source-example-1:
      summary: Document Source Example 1
      description: An example for a document `Source`.
      value:
        source_id: src_oXiYDg8QOc9JsOk86idRXiywD
        source_type: document
        bytes: 1234567
        created_at: '2024-03-01T00:00:00Z'
        updated_at: '2024-03-01T00:00:00Z'
        title: Totoy Company Overview
        document_file_name: totoy-company-overview.pdf
        backlink: https://www.totoy.ai/totoy-company-overview.pdf
        valid_from: '2024-01-01T00:00:00Z'
        valid_until: '2026-12-31T23:59:59Z'
        project_id: pj_avX7imfLaPcQnv5ckvGlOEBA9
        custom_metadata:
          internal_tag: general_documents
        knowledge_base_ids:
          - kb_feMfJbeqbAEj4u8K5HqmKpUbY
          - kb_2eMfJbeqbAEj4u8K5HqmKpUbY
        status: completed
        pages: 27
    source-id-example:
      summary: Source ID Example 2
      description: An example for a `source_id` for another PDF document source.
      value: src_oXiYDg8QOc9JsOk86idRXiywD
  responses:
    general4XXResponse:
      description: Client Error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    general5XXResponse:
      description: Server Error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer

````