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

# Extract

> Extract structured content from text, HTML, or URLs according to configured extractors.

## Description

This endpoint extracts structured data from a specified URL based on a user-defined schema. It uses visual and textual information from the webpage to extract the requested data.

## Endpoint

```
POST https://app.dumplingai.com/api/v1/extract
```

## Headers

* **Content-Type:** `application/json`
* **Authorization:** Bearer `<API_KEY>` (required)

## Request Body

```json theme={null}
{
  "url": "string", // Required. The URL to extract data from.
  "schema": "object" // Required. The schema defining the data to extract.
}
```

## Responses

### Success (200)

Returns the extracted data based on the provided schema, along with a URL to the screenshot of the page.

```json theme={null}
{
  "screenshotUrl": "string", // URL of the captured screenshot
  "results": "object" // Extracted data matching the provided schema
}
```

* **Content-Type:** application/json
* **X-RateLimit-Limit:** The rate limit for the user.
* **X-RateLimit-Remaining:** The remaining number of requests for the user.

### Bad Request (400)

Returned if the request is invalid.

```json theme={null}
{
  "error": "Error message describing the issue"
}
```

### Internal Server Error (500)

Returned if there's an error during the extraction process.

```json theme={null}
{
  "error": "Failed to extract URL: [error details]"
}
```

## Example Request

```bash theme={null}
curl -X POST https://app.dumplingai.com/api/v1/extract \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "url": "https://example.com",
  "schema": {
    "title": "string",
    "description": "string",
    "price": "number",
    "rating": "number"
  }
}'
```

## Example Response

```json theme={null}
{
  "screenshotUrl": "https://storage.example.com/screenshots/abcdef123456.png",
  "results": {
    "title": "Example Product",
    "description": "This is an example product description.",
    "price": 29.99,
    "rating": 4.5
  }
}
```

## Notes

* The extraction process uses both visual (screenshot) and textual (HTML) information from the webpage.
* The extracted data is limited to a single object. Extracting lists of objects may require separate handling.
* The maximum allowed content for extraction is 100,000 tokens. If the content exceeds this limit, it will be truncated.
* If the URL doesn't include a protocol, `https://` will be used by default.
* This endpoint uses 250 credits per request.
* The extraction is performed using a combination of web scraping and AI-powered analysis (Claude 3 Haiku model).

## Rate Limiting

Rate limit headers (`X-RateLimit-Limit` and `X-RateLimit-Remaining`) are included in the response to indicate the user's current rate limit status.


## OpenAPI

````yaml POST /api/v1/extract
openapi: 3.0.3
info:
  title: DumplingAI API
  version: 1.0.0
  description: >
    REST API for DumplingAI's content intelligence and automation platform.

    All endpoints are grouped under `/api/v1`; most are secured via Bearer API
    keys unless an operation explicitly sets `security: []`.
servers:
  - url: https://app.dumplingai.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: YouTube
    description: Access metadata, search results, and transcripts from YouTube.
  - name: TikTok
    description: Retrieve TikTok profile, video, follower, and transcript data.
  - name: LinkedIn
    description: Programmatically fetch LinkedIn company and profile data.
  - name: Search
    description: Search-orientated endpoints spanning web, news, maps, and autocomplete.
  - name: Google
    description: Integrations with Google business listings and location data.
  - name: Scraping
    description: Webpage capture, crawling, and structured content extraction utilities.
  - name: Documents
    description: Document processing, conversion, and metadata utilities.
  - name: AI
    description: DumplingAI agent and knowledge base endpoints.
  - name: Developer Tools
    description: Utilities for executing sandboxed code via API.
paths:
  /api/v1/extract:
    post:
      tags:
        - Documents
      summary: Extract structured content
      description: >-
        Extract structured content from text, HTML, or URLs according to
        configured extractors.
      operationId: extractStructuredContent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtractRequest'
            examples:
              default:
                value:
                  url: https://example.com/product-page
                  schema:
                    title: string
                    description: string
                    price: number
                    rating: number
      responses:
        '200':
          description: Extracted content returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractResponse'
        '400':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ExtractRequest:
      type: object
      required:
        - url
        - schema
      properties:
        url:
          type: string
          format: uri
          description: Fully-qualified URL to extract content from.
        schema:
          type: object
          description: JSON schema describing the structure of the extracted data.
          additionalProperties: true
        requestSource:
          $ref: '#/components/schemas/RequestSource'
      additionalProperties: false
    ExtractResponse:
      type: object
      required:
        - screenshotUrl
        - results
      properties:
        screenshotUrl:
          type: string
          format: uri
          description: >-
            Temporary URL pointing to the captured screenshot of the source
            page.
        results:
          type: object
          description: Data extracted according to the provided schema.
          additionalProperties: true
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable description of what went wrong.
      required:
        - error
    RequestSource:
      type: string
      description: Optional identifier describing where the API request originated.
      enum:
        - API
        - WEB
        - MAKE_DOT_COM
        - ZAPIER
        - N8N
        - PLAYGROUND
        - DEFAULT_AUTOMATION
        - AGENT_PREVIEW
        - AGENT_LIVE
        - AUTOPILOT
        - STUDIO
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````