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

# Extract Examples

> Ready-to-adapt Extract API recipes for structured data, lists, Q&A, summaries, and brand enrichment.

## Program Data

<CodeGroup>
  ```typescript TypeScript theme={null}
  const program = await client.extract('https://www.ycombinator.com/about', {
    modes: ['json'],
    jsonSchema: {
      program: 'string',
      duration: 'string',
      funding: 'string',
      benefits: ['string'],
    },
    instructions: 'Return concise values. Use null when a field is missing.',
  });

  console.log(program.structured_data);
  ```

  ```python Python theme={null}
  program = client.extract(
      "https://www.ycombinator.com/about",
      modes=["json"],
      json_schema={
          "program": "string",
          "duration": "string",
          "funding": "string",
          "benefits": ["string"],
      },
      instructions="Return concise values. Use null when a field is missing.",
  )

  print(program.structured_data)
  ```
</CodeGroup>

## List Extraction

Use an array in your schema when the page contains repeated items.

```python theme={null}
posts = client.extract(
    "https://www.ycombinator.com/blog",
    modes=["json"],
    json_schema={
        "posts": [
            {
                "title": "string",
                "url": "string",
                "date": "string",
            }
        ]
    },
    instructions="Preserve each article URL when available.",
)

for post in posts.structured_data.get("posts", []):
    print(post["title"], post.get("date"), post.get("url"))
```

## Page Summary + Q\&A

```typescript theme={null}
const result = await client.extract('https://www.ycombinator.com/blog', {
  modes: ['summary', 'qa'],
  query: 'What are the three most actionable recommendations?',
  responseLanguage: 'en',
});

console.log(result.summary);
console.log(result.answer);
```

## Brand Enrichment

```python theme={null}
brand = client.extract(
    "https://www.ycombinator.com",
    modes=["brand", "links"],
)

print(brand.brand)
print(brand.links[:10] if brand.links else [])
```

## Combined Workflow

```typescript theme={null}
const site = await client.extract('https://www.ycombinator.com', {
  modes: ['summary', 'brand', 'links'],
});

const posts = await client.extract('https://www.ycombinator.com/blog', {
  modes: ['json'],
  jsonSchema: {
    posts: [
      {
        title: 'string',
        url: 'string',
        date: 'string',
      },
    ],
  },
});

console.log(site.summary);
console.log(site.brand);
console.log(posts.structured_data);
```

## Reliability Tips

* Keep `json_schema` focused on fields visible on the page.
* Use `instructions` for normalization rules, not for unrelated business logic.
* Split very large pages into scrape/search workflows when extraction output gets too large.
* Treat `structured_data` as the only structured extraction result field.

## Related

<CardGroup cols={2}>
  <Card title="Extract API" icon="wand-magic-sparkles" href="/extract">
    Main guide and response contract.
  </Card>

  <Card title="Errors & Refunds" icon="triangle-exclamation" href="/errors">
    Error codes and refund behavior.
  </Card>
</CardGroup>
