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

# DIAN Doctrina Search

> Full-text search over DIAN's published tax doctrine and related legal compilation: oficios, conceptos, decretos, resoluciones, leyes and high-court rulings. Each hit carries the `document_id` used by `dian-doctrina-document`, plus the title, issuing body, epigraph and a matching excerpt. Optional filters: `document_type` (e.g. `Oficios`, `Conceptos`) and `year`. Paginated with `page` and `per_page`; `capped: true` means the source returned more matches than are retrievable, so narrow the query.



## OpenAPI

````yaml /api-reference/openapi.json post /co/dian/doctrina-search/v1
openapi: 3.1.0
info:
  title: Croma Marketplace API
  version: 1.0.0
  description: >-
    Government-data APIs for Colombia, Peru, Mexico, and global web search.
    Croma normalizes public-sector data into structured JSON for product teams
    and AI agents.
servers:
  - url: https://api.croma.run
security: []
paths:
  /co/dian/doctrina-search/v1:
    post:
      tags:
        - Colombia
        - DIAN
      summary: DIAN Doctrina Search
      description: >-
        Full-text search over DIAN's published tax doctrine and related legal
        compilation: oficios, conceptos, decretos, resoluciones, leyes and
        high-court rulings. Each hit carries the `document_id` used by
        `dian-doctrina-document`, plus the title, issuing body, epigraph and a
        matching excerpt. Optional filters: `document_type` (e.g. `Oficios`,
        `Conceptos`) and `year`. Paginated with `page` and `per_page`; `capped:
        true` means the source returned more matches than are retrievable, so
        narrow the query.
      operationId: dian_doctrina_search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  minLength: 2
                  maxLength: 300
                  description: >-
                    Términos de búsqueda en el texto de la doctrina (p. ej.
                    `dividendos`).
                document_type:
                  type: string
                  maxLength: 60
                  default: ''
                  description: >-
                    Filtro por tipo de documento (p. ej. `Oficios`,
                    `Conceptos`). Vacío para todos.
                year:
                  type: string
                  default: ''
                  description: Filtro por año de expedición (yyyy). Vacío para todos.
                page:
                  type: integer
                  minimum: 1
                  maximum: 1000
                  default: 1
                  description: 1-based page number for paginated results.
                per_page:
                  type: integer
                  minimum: 1
                  maximum: 100
                  default: 20
                  description: Resultados por página (1-100).
              additionalProperties: false
            example:
              query: dividendos
              document_type: Conceptos
      responses:
        '200':
          description: Successful response
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
            X-RateLimit-Limit:
              description: Requests allowed in the current window.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests left before you are throttled.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: ISO 8601 timestamp when the window resets.
              schema:
                type: string
                format: date-time
            X-Cache:
              description: HIT or MISS. Cached hits still count against your quota.
              schema:
                type: string
                enum:
                  - HIT
                  - MISS
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DianDoctrinaSearchResponse'
        '400':
          description: Invalid request body
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Missing or invalid API key
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: Rate limit exceeded
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
            X-RateLimit-Limit:
              description: Requests allowed in the current window.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests left before you are throttled.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: ISO 8601 timestamp when the window resets.
              schema:
                type: string
                format: date-time
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: Internal error
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '502':
          description: Upstream source returned an error
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - bearerAuth: []
      externalDocs:
        description: Interactive documentation and examples
        url: https://docs.usecroma.com/guides/colombia/dian
components:
  schemas:
    DianDoctrinaSearchResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          required:
            - query
            - document_type
            - year
            - page
            - per_page
            - total
            - count
            - capped
            - results
          properties:
            query:
              type: string
              description: Términos consultados.
            document_type:
              type:
                - string
                - 'null'
              description: Filtro aplicado.
            year:
              type:
                - string
                - 'null'
              description: Filtro aplicado.
            page:
              type: integer
            per_page:
              type: integer
            total:
              type: integer
              description: Coincidencias tras aplicar los filtros.
            count:
              type: integer
              description: Resultados en esta página.
            capped:
              type: boolean
              description: >-
                Verdadero cuando la fuente devolvió más coincidencias de las
                recuperables; refine la consulta.
            results:
              type: array
              items:
                $ref: '#/components/schemas/DianDoctrinaHit'
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
          properties:
            type:
              type: string
              description: >-
                Broad category: invalid_request_error, authentication_error,
                not_found_error, rate_limit_error, upstream_error, api_error.
            code:
              type: string
              description: Machine-readable specific code.
            message:
              type: string
              description: Human-readable explanation, safe to surface in UI.
            param:
              type: string
              description: Field that triggered the error. Present on validation errors.
            details:
              type: object
              description: Free-form structured detail.
    DianDoctrinaHit:
      type: object
      required:
        - document_id
        - title
        - document_type
        - number
        - year
        - issuer
        - summary
        - excerpt
        - url
      properties:
        document_id:
          type: string
          description: >-
            Identificador del documento; se pasa tal cual a
            `dian-doctrina-document`.
        title:
          type:
            - string
            - 'null'
          description: Título oficial del documento.
        document_type:
          type:
            - string
            - 'null'
          description: Tipo de documento (p. ej. `Oficios`, `Conceptos`, `Decretos`).
        number:
          type:
            - string
            - 'null'
          description: Número del documento.
        year:
          type:
            - string
            - 'null'
          description: Año de expedición.
        issuer:
          type:
            - string
            - 'null'
          description: Entidad que expidió el documento.
        summary:
          type:
            - string
            - 'null'
          description: Epígrafe o descripción corta del documento.
        excerpt:
          type:
            - string
            - 'null'
          description: Fragmento del texto donde coincide la búsqueda.
        url:
          type: string
          format: uri
          description: URL pública del documento.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Use Authorization: Bearer YOUR_API_KEY'

````