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

# Scrape

> Fetches content from a URL and returns it in HTML or Markdown format with optional link extraction



## OpenAPI

````yaml post /scrape
openapi: 3.1.0
info:
  contact:
    email: support@blat.ai
    name: Blat Support
  description: >-
    A web scraping API that supports HTML and Markdown output with optional link
    extraction.
  title: Scrape API
  version: '1.0'
servers:
  - url: https://api.blat.ai
security: []
externalDocs:
  description: ''
  url: ''
paths:
  /scrape:
    post:
      tags:
        - scraping
      summary: Scrape
      description: >-
        Fetches content from a URL and returns it in HTML or Markdown format
        with optional link extraction
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/api.ScrapeRequest'
        description: Scraping request parameters
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/api.ScrapeResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Invalid request parameters
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Unauthorized - Make sure you have a valid API key
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Couldn't find the website
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Couldn't fetch the content from the target website
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Rate limit exceeded
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Unknown Error
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Failed to fetch URL / Website is unavailable
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/utils.APIError'
          description: Request timeout
      security:
        - bearerauth: []
components:
  schemas:
    api.ScrapeRequest:
      properties:
        allow_external_links:
          default: false
          description: Whether to include external links
          type: boolean
        allow_subdomain_links:
          default: false
          description: Whether to include subdomain links
          type: boolean
        extract_links:
          default: false
          description: Whether to extract links from HTML
          type: boolean
        format:
          $ref: '#/components/schemas/api.Format'
        url:
          description: The URL to fetch content from
          example: https://example.com
          type: string
      required:
        - url
    api.ScrapeResponse:
      example:
        extracted_links:
          - extracted_links
          - extracted_links
        content: content
      properties:
        content:
          description: The HTML or Markdown content
          type: string
        extracted_links:
          description: Extracted links, omitted if empty or not requested
          items:
            type: string
          type: array
          uniqueItems: false
    utils.APIError:
      example:
        code: code
        details:
          key: ''
        message: message
      properties:
        code:
          type: string
        details:
          additionalProperties: {}
        message:
          type: string
    api.Format:
      default: html
      description: The desired output format
      enum:
        - html
        - markdown
      type: string
      x-enum-varnames:
        - FormatHTML
        - FormatMarkdown
  securitySchemes:
    bearerauth:
      bearerFormat: JWT
      scheme: bearer
      type: http

````