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

# Describe a datasource

> The exposed tables and columns on one datasource, with types, keys, row estimates, profiled statistics, and any published documentation. Call this before writing a query — it carries the context column names don't.

`full=1` instead returns the complete introspected schema, including tables nobody has exposed — the list an admin picks exposure from. It requires your account to manage this datasource (an admin/owner team role), independent of your key's scopes, and 409s with `NOT_CONNECTED` if the datasource has never been introspected.



## OpenAPI

````yaml /openapi.json get /teams/{teamId}/datasources/{id}/schema
openapi: 3.1.0
info:
  title: TeamDuo REST API
  version: 1.0.0
  description: >-
    The subset of TeamDuo's REST API that an API key may call. Most of TeamDuo's
    backend is session-only by design — connecting a database, changing
    exposure, and managing your team all require a signed-in browser session.
    These five endpoints are the ones a key can reach, matching the read-only
    surface the MCP connector uses. See [Overview](/api-reference/introduction)
    before using this reference.
servers:
  - url: https://api.teamduo.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /teams/{teamId}/datasources/{id}/schema:
    get:
      tags:
        - Datasources
      summary: Describe a datasource
      description: >-
        The exposed tables and columns on one datasource, with types, keys, row
        estimates, profiled statistics, and any published documentation. Call
        this before writing a query — it carries the context column names don't.


        `full=1` instead returns the complete introspected schema, including
        tables nobody has exposed — the list an admin picks exposure from. It
        requires your account to manage this datasource (an admin/owner team
        role), independent of your key's scopes, and 409s with `NOT_CONNECTED`
        if the datasource has never been introspected.
      operationId: describeDataSource
      parameters:
        - name: teamId
          in: path
          required: true
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Datasource id from `GET /teams/{teamId}/datasources`.
        - name: full
          in: query
          required: false
          schema:
            type: string
            enum:
              - '1'
          description: >-
            Pass `1` for the full introspected schema instead of the exposed
            subset. Requires a manage-level team role.
      responses:
        '200':
          description: >-
            The exposed subset (default), or the full introspected schema when
            `full=1`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataSourceDescription'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such datasource, or you can't reach it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `full=1` was requested but this datasource has never been
            introspected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: This datasource has not been introspected yet.
                code: NOT_CONNECTED
      security:
        - bearerAuth:
            - data:schema
components:
  schemas:
    DataSourceDescription:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
            - POSTGRES
            - MONGODB
            - BIGQUERY
        vocabulary:
          type: object
          description: >-
            What this source calls its own concepts — write a query using these
            words, not "schema"/"table" by default.
          properties:
            schema:
              type: string
            table:
              type: string
            queryLanguage:
              type: string
        schemaCapturedAt:
          type:
            - string
            - 'null'
          format: date-time
        profileCapturedAt:
          type:
            - string
            - 'null'
          format: date-time
        tables:
          type: array
          items:
            $ref: '#/components/schemas/ExposedTable'
      required:
        - id
        - name
        - type
        - vocabulary
        - tables
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable explanation. Always safe to show a user or an agent.
        code:
          type: string
          description: Stable machine-readable code, when the error has one.
      required:
        - error
    ExposedTable:
      type: object
      properties:
        schema:
          type: string
          description: >-
            Schema (Postgres), database (MongoDB), or dataset (BigQuery) — see
            `vocabulary` on the parent object.
        table:
          type: string
        description:
          type:
            - string
            - 'null'
        documentation:
          type:
            - object
            - 'null'
          properties:
            summary:
              type:
                - string
                - 'null'
            statements:
              type: array
              items:
                type: string
              description: Confirmed or accepted facts about this table.
            examples:
              type:
                - string
                - 'null'
            publishedAt:
              type: string
              format: date-time
        estimatedRows:
          type:
            - integer
            - 'null'
        columnsRestricted:
          type: boolean
          description: True when only some of this table's columns are exposed.
        indexes:
          type: array
          items: {}
          description: MongoDB only. Omitted where indexes are not a meaningful concept.
        columns:
          type: array
          items:
            $ref: '#/components/schemas/ExposedColumn'
      required:
        - schema
        - table
        - columns
    ScopeError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          properties:
            code:
              type: string
              const: SCOPE_REQUIRED
            requiredScope:
              type: string
              description: >-
                The scope this key is missing, when the route needs a specific
                one.
    ExposedColumn:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          description: >-
            The driver's own type name — a Postgres type, a BigQuery type, or
            `"bson"` for MongoDB.
        nullable:
          type: boolean
        primaryKey:
          type: boolean
        references:
          description: The foreign key this column points to, if any.
        description:
          type:
            - string
            - 'null'
        stats:
          $ref: '#/components/schemas/ColumnStats'
      required:
        - name
        - type
        - nullable
        - primaryKey
    ColumnStats:
      type:
        - object
        - 'null'
      properties:
        nullFrac:
          type:
            - number
            - 'null'
        distinctCount:
          type:
            - integer
            - 'null'
        values:
          type:
            - array
            - 'null'
          items: {}
          description: The most common values seen, when the column looks categorical.
        range:
          description: Min/max, for dates and numerics.
        signals:
          type: array
          items:
            type: string
          description: >-
            Notable derived observations, e.g. that a column is always populated
            despite being nullable.
  responses:
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The token is valid but its scopes don't cover this route.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ScopeError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key (`sk_live_...`) created under Settings → API keys, or a
        short-lived JWT access token from a browser session. A key only reaches
        the scope it was granted; see [API keys and
        scopes](/reference/api-keys).

````