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

# Get Document By External Id

> Retrieve the latest document by its external ID.



## OpenAPI

````yaml get /api/v1/documents/external/{external_id}
openapi: 3.1.0
info:
  title: Fieldwise API
  description: API for the Fieldwise platform.
  version: 1.0.0
servers:
  - url: https://api.fieldwise.ai
security:
  - ApiKeyAuth: []
paths:
  /api/v1/documents/external/{external_id}:
    get:
      tags:
        - Documents
      summary: Get Document By External Id
      description: Retrieve the latest document by its external ID.
      operationId: get_document_by_external_id_api_v1_documents_external__external_id__get
      parameters:
        - name: external_id
          in: path
          required: true
          schema:
            type: string
            title: External Id
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentResponse'
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: Unprocessable Entity
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
          description: Internal Server Error
components:
  schemas:
    DocumentResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        data:
          allOf:
            - $ref: '#/components/schemas/DocumentResponseData'
          description: Response data
        error:
          anyOf:
            - $ref: '#/components/schemas/ErrorDetail'
            - type: 'null'
        meta:
          $ref: '#/components/schemas/MetaData'
      type: object
      required:
        - data
      title: DocumentResponse
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        error_code:
          type: string
          title: Error Code
          description: Error code identifier
        details:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Details
          description: Additional error details
      type: object
      required:
        - message
        - error_code
      title: ErrorDetail
      description: Schema for API error responses.
      example:
        error_code: RESOURCE_NOT_FOUND
        message: Resource not found
    DocumentResponseData:
      properties:
        id:
          type: integer
          title: Id
          description: Document identifier
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: External identifier
        file_path:
          anyOf:
            - type: string
            - type: 'null'
          title: File Path
          description: File storage path
        file_url:
          anyOf:
            - type: string
            - type: 'null'
          title: File Url
          description: Presigned S3 download URL for the document
        document_metadata:
          anyOf:
            - type: object
            - type: 'null'
          title: Document Metadata
          description: Document metadata
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last update timestamp
        pages:
          items:
            $ref: '#/components/schemas/DocumentPage'
          type: array
          title: Pages
          description: Document pages
      type: object
      required:
        - id
        - created_at
        - updated_at
        - pages
      title: DocumentResponseData
    MetaData:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        version:
          type: string
          title: Version
          default: '1.0'
      type: object
      title: MetaData
      description: Metadata for API responses
    DocumentPage:
      properties:
        id:
          type: integer
          title: Id
          description: Page identifier
        page_number:
          type: integer
          title: Page Number
          description: Page number
        content:
          type: string
          title: Content
          description: Page content
      type: object
      required:
        - id
        - page_number
        - content
      title: DocumentPage
      example:
        content: This is the content of page 1...
        page_number: 1
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````