> ## 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 Document

> Retrieve the text of one DIAN doctrine document by the `document_id` returned by `dian-doctrina-search`: the official title and the body of the oficio, concepto or norm. Compiled norms run to millions of characters, so the body is returned in character ranges: `content.total_length` is the full size, and when `content.has_more` is true request the next range with `offset: content.next_offset`. `found: false` when no document carries that id.



## OpenAPI

````yaml /api-reference/openapi.json post /co/dian/doctrina/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/v1:
    post:
      tags:
        - Colombia
        - DIAN
      summary: DIAN Doctrina Document
      description: >-
        Retrieve the text of one DIAN doctrine document by the `document_id`
        returned by `dian-doctrina-search`: the official title and the body of
        the oficio, concepto or norm. Compiled norms run to millions of
        characters, so the body is returned in character ranges:
        `content.total_length` is the full size, and when `content.has_more` is
        true request the next range with `offset: content.next_offset`. `found:
        false` when no document carries that id.
      operationId: dian_doctrina_document
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - document_id
              properties:
                document_id:
                  type: string
                  pattern: ^[A-Za-z0-9_()[\]-]{3,120}$
                  description: >-
                    `document_id` devuelto por la búsqueda (p. ej.
                    `oficio_dian_18075_2023`).
                offset:
                  type: integer
                  minimum: 0
                  maximum: 10000000
                  default: 0
                  description: >-
                    First character of the range to return. Pass the previous
                    response's `next_offset` to continue reading.
                limit:
                  type: integer
                  minimum: 1000
                  maximum: 1000000
                  default: 200000
                  description: Maximum characters to return (1000-1000000).
              additionalProperties: false
            example:
              document_id: oficio_dian_18075_2023
      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/DianDoctrinaDocumentResponse'
        '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:
    DianDoctrinaDocumentResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          required:
            - found
            - document_id
            - title
            - content
            - url
          properties:
            found:
              type: boolean
              description: Falso cuando ningún documento corresponde al `document_id`.
            document_id:
              type: string
            title:
              type:
                - string
                - 'null'
              description: Título oficial.
            content:
              oneOf:
                - $ref: '#/components/schemas/DianDoctrinaContent'
                - type: 'null'
              description: Null cuando `found` es falso.
            url:
              type: string
              format: uri
    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.
    DianDoctrinaContent:
      type: object
      required:
        - text
        - offset
        - total_length
        - has_more
        - next_offset
      properties:
        text:
          type: string
          description: Fragmento del texto del documento en el rango solicitado.
        offset:
          type: integer
          description: Carácter inicial de este fragmento.
        total_length:
          type: integer
          description: Longitud total del documento en caracteres.
        has_more:
          type: boolean
          description: Verdadero cuando queda texto por recuperar.
        next_offset:
          type:
            - integer
            - 'null'
          description: >-
            `offset` a usar para el siguiente fragmento; null cuando no queda
            más.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Use Authorization: Bearer YOUR_API_KEY'

````