Skip to content

Commit b996582

Browse files
VinciGit00claude
andauthored
docs(api): document MIME and PDF processor options (#93)
* docs(mcp): add OAuth login steps * docs(mcp): rebuild MCP section from the hosted server as source of truth Verified every claim against the live server at mcp.scrapegraphai.com and the apps/mcp implementation. - remove the "Star us on GitHub" card - drop the local stdio path: `pip install scrapegraph-mcp` resolves to PyPI 1.0.1, which exposes 8 pre-v3 tools (markdownify, smartscraper, ...) and does not match the v2 API this section documents - drop the Smithery page for the same reason, with a redirect to the introduction and inbound links repointed - document the transport honestly: Streamable HTTP only, SSE unsupported, 60s per tool call - document all three accepted API key headers, plus OAuth 2.1 with PKCE S256 and the mcp:use scope - correct the tool table to /api/* paths with real defaults and limits - replace the migration note's dead v3.0.0 release link with a legacy name mapping table - collapse the four client pages onto one shape: configure, authenticate, API key alternative, verify with `credits` - bump the Claude Desktop mcp-remote pin from 0.1.25 to 0.1.38 * docs(search): document contentTypes filter Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(search): document PDF options * docs(search): explain default MIME allowlist * docs(api): align MIME and PDF options * docs(api): clarify default PDF page cap * docs(pdf): clarify per-page credit cost --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 6cbdf2f commit b996582

9 files changed

Lines changed: 108 additions & 4 deletions

File tree

api-reference/endpoint/extract.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ Exactly one of `url`, `html`, or `markdown` must be supplied as the source.
3737
HTML pre-processing mode: `"normal"`, `"reader"`, or `"prune"`.
3838
</ParamField>
3939

40+
<ParamField body="allowedTypes" type="array">
41+
Optional non-empty MIME allowlist for URL input. Omit it to allow every supported type; `"all"` and `"*"` are not accepted.
42+
</ParamField>
43+
44+
<ParamField body="processors" type="array">
45+
Optional processing configuration for URL input. Omit this field to use the 25-page PDF cap. You
46+
may also send `{"type":"pdf"}` and omit `maxPages`; it defaults to `25`. Set `maxPages` only to
47+
override the default, using `1``500`, or `-1` for no page limit. PDF processing costs 1 credit
48+
per page actually processed.
49+
</ParamField>
50+
4051
<ParamField body="fetchConfig" type="object">
4152
Fetch-time options. See the [Scrape endpoint](/api-reference/endpoint/scrape#request-body) for the full field list (`mode`, `stealth`, `headers`, `cookies`, `scrolls`, `wait`, `timeout`, `country`). Ignored when `html` or `markdown` is supplied.
4253
</ParamField>

api-reference/endpoint/scrape.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ Returns markdown, HTML, links, images, summary, JSON extraction, branding, or sc
3434
Override auto-detected content type. Common values: `"text/html"`, `"application/pdf"`.
3535
</ParamField>
3636

37+
<ParamField body="allowedTypes" type="array">
38+
Optional non-empty MIME allowlist. Omit it to allow every supported type; `"all"` and `"*"` are not accepted.
39+
</ParamField>
40+
41+
<ParamField body="processors" type="array">
42+
Optional processing configuration. Omit this field to use the 25-page PDF cap. You may also send
43+
`{"type":"pdf"}` and omit `maxPages`; it defaults to `25`. Set `maxPages` only to override the
44+
default, using `1``500`, or `-1` for no page limit. PDF processing costs 1 credit per page
45+
actually processed.
46+
</ParamField>
47+
3748
<ParamField body="fetchConfig" type="object">
3849
Fetch-time options. All fields are optional.
3950

api-reference/endpoint/search.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ Replaces the v1 `searchscraper` endpoint. Returns the top pages with their conte
3939
ISO 3166-1 alpha-2 country code for localized results (e.g. `"us"`, `"it"`).
4040
</ParamField>
4141

42+
<ParamField body="allowedTypes" type="array">
43+
Optional MIME allowlist for fetched results. Omit this field to allow every supported type, including `application/pdf`. There is no `"all"` or `"*"` keyword. When provided, it must be a non-empty array of exact supported MIME types, such as `["text/html", "application/pdf"]`. Rejected types are reported as failed pages and do not appear in `results`.
44+
</ParamField>
45+
46+
<ParamField body="processors" type="array">
47+
Optional processing configuration. Omit this field to use the 25-page PDF cap. You may also send
48+
`{"type":"pdf"}` and omit `maxPages`; it defaults to `25`. Set `maxPages` only to override the
49+
default, using `1``500`, or `-1` for no page limit. PDF processing costs 1 credit per page
50+
actually processed. This does not change `allowedTypes`.
51+
</ParamField>
52+
4253
<ParamField body="fetchConfig" type="object">
4354
Fetch-time options applied when crawling each result. See the [Scrape endpoint](/api-reference/endpoint/scrape#request-body) for the full field list.
4455
</ParamField>
@@ -51,7 +62,9 @@ curl -X POST https://v2-api.scrapegraphai.com/api/search \
5162
-H "Content-Type: application/json" \
5263
-d '{
5364
"query": "scrapegraphai pricing",
54-
"numResults": 3
65+
"numResults": 3,
66+
"allowedTypes": ["text/html", "application/pdf"],
67+
"processors": [{"type": "pdf", "maxPages": 10}]
5568
}'
5669
```
5770

sdks/javascript.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ if (res.status === "success") {
240240
| `format` | `string` | No | `"markdown"` (default) or `"html"` |
241241
| `timeRange` | `string` | No | `"past_hour"`, `"past_24_hours"`, `"past_week"`, `"past_month"`, `"past_year"` |
242242
| `locationGeoCode` | `string` | No | Two-letter country code (e.g. `"us"`) |
243+
| `allowedTypes` | `string[]` | No | Non-empty MIME allowlist. Omit it for all supported types; `"all"` and `"*"` are not accepted |
244+
| `processors` | `object[]` | No | Omit for the 25-page PDF cap. `{ type: "pdf" }` also defaults to 25; set `maxPages` only to override it, or use `-1` for unlimited. PDF processing costs 1 credit per page actually processed |
243245
| `fetchConfig` | `FetchConfig` | No | Fetch configuration |
244246
245247
<Accordion title="Search + extraction" icon="code">
@@ -301,7 +303,8 @@ await sgai.crawl.delete(crawlId);
301303
| `allowExternal` | `boolean` | No | Allow crossing domains. Default: `false` |
302304
| `includePatterns` | `string[]` | No | URL patterns to include |
303305
| `excludePatterns` | `string[]` | No | URL patterns to exclude |
304-
| `contentTypes` | `string[]` | No | Allowed content types |
306+
| `allowedTypes` | `string[]` | No | Non-empty MIME allowlist; omit it to allow every supported type |
307+
| `processors` | `object[]` | No | Omit for the 25-page PDF cap. `{ type: "pdf" }` also defaults to 25; set `maxPages` only to override it, or use `-1` for unlimited. PDF processing costs 1 credit per page actually processed |
305308
| `fetchConfig` | `FetchConfig` | No | Fetch configuration |
306309
307310
### `sgai.monitor.*`

sdks/python.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ if res.status == "success":
270270
| `schema` | `dict` | No | JSON Schema for structured output. Pass a Pydantic model's `model_json_schema()` to reuse a `BaseModel`. |
271271
| `location_geo_code` | `str` | No | Two-letter country code (e.g. `"us"`, `"it"`) |
272272
| `time_range` | `str` | No | `"past_hour"`, `"past_24_hours"`, `"past_week"`, `"past_month"`, `"past_year"` |
273+
| `allowed_types` | `list[str]` | No | Non-empty MIME allowlist. Omit it for all supported types; `"all"` and `"*"` are not accepted |
274+
| `processors` | `list[PdfProcessor]` | No | Omit for the 25-page PDF cap. `PdfProcessor()` also defaults to 25; set `max_pages` only to override it, or use `-1` for unlimited. PDF processing costs 1 credit per page actually processed |
273275
| `fetch_config` | `FetchConfig` | No | Fetch configuration |
274276

275277
### Crawl
@@ -316,7 +318,8 @@ sgai.crawl.delete(crawl_id)
316318
| `allow_external` | `bool` | No | Default `False` |
317319
| `include_patterns` | `list[str]` | No | URL glob patterns to include |
318320
| `exclude_patterns` | `list[str]` | No | URL glob patterns to exclude |
319-
| `content_types` | `list[str]` | No | Allowed response content types |
321+
| `allowed_types` | `list[str]` | No | Non-empty MIME allowlist; omit it to allow every supported type |
322+
| `processors` | `list[PdfProcessor]` | No | Omit for the 25-page PDF cap. `PdfProcessor()` also defaults to 25; set `max_pages` only to override it, or use `-1` for unlimited. PDF processing costs 1 credit per page actually processed |
320323
| `fetch_config` | `FetchConfig` | No | Fetch configuration |
321324

322325
### Monitor

services/crawl.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ curl -X GET "https://v2-api.scrapegraphai.com/api/crawl/:id/pages?limit=50&curso
133133
| `allowExternal` / `allow_external` | bool | No | Whether to follow links to other domains. Default `false` (same-origin only). |
134134
| `includePatterns` / `include_patterns` | array | No | URL patterns to include (e.g. `["/blog/*"]`). |
135135
| `excludePatterns` / `exclude_patterns` | array | No | URL patterns to exclude (e.g. `["/admin/*"]`). |
136-
| `contentTypes` / `content_types` | array | No | Limit crawled pages to these MIME types, e.g. `["text/html", "application/pdf"]`. |
136+
| `allowedTypes` / `allowed_types` | array | No | Non-empty MIME allowlist. Omit it for all supported types; `"all"` and `"*"` are invalid. |
137+
| `processors` | array | No | Omit for the 25-page PDF cap. Send it only to override the cap; `maxPages` also defaults to 25 when omitted, and `-1` means unlimited. PDF processing costs 1 credit per page actually processed. |
137138
| `fetchConfig` / `fetch_config` | object | No | Fetch options (see [Scrape · FetchConfig](/services/scrape#fetchconfig)). |
138139

139140
<Note>

services/extract.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ curl -X POST https://v2-api.scrapegraphai.com/api/extract \
7979
| `prompt` | string | Yes | Natural-language description of what to extract. |
8080
| `schema` | object | No | JSON schema describing the desired output shape. In Python you can pass a Pydantic model via `MyModel.model_json_schema()`. |
8181
| `mode` | string | No | HTML processing mode: `"normal"`, `"reader"`, `"prune"`. |
82+
| `allowedTypes` / `allowed_types` | array | No | Non-empty MIME allowlist for URL input. Omit it for all supported types; `"all"` and `"*"` are invalid. |
83+
| `processors` | array | No | Omit for the 25-page PDF cap. Send it only to override the cap; `maxPages` also defaults to 25 when omitted, and `-1` means unlimited. PDF processing costs 1 credit per page actually processed. |
8284
| `fetchConfig` / `fetch_config` | object | No | Fetch options (see [Scrape · FetchConfig](/services/scrape#fetchconfig)). |
8385
8486
<Note>

services/scrape.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ curl -X POST https://v2-api.scrapegraphai.com/api/scrape \
8888
| `url` | string | Yes | The URL of the webpage to scrape. |
8989
| `formats` | array | Yes | One or more output formats (see [Formats](#output-formats)). |
9090
| `contentType` | string | No | Override auto-detected content type (e.g. `"text/html"`, `"application/pdf"`). |
91+
| `allowedTypes` / `allowed_types` | array | No | Non-empty MIME allowlist. Omit it for all supported types; `"all"` and `"*"` are invalid. |
92+
| `processors` | array | No | Omit for the 25-page PDF cap. Send it only to override the cap; `maxPages` also defaults to 25 when omitted, and `-1` means unlimited. PDF processing costs 1 credit per page actually processed. |
9193
| `fetchConfig` / `fetch_config` | object | No | Fetch options — `mode`, `stealth`, `headers`, `cookies`, `scrolls`, `wait`, `timeout`, `country`. |
9294
9395
<Note>

services/search.mdx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,70 @@ curl -X POST https://v2-api.scrapegraphai.com/api/search \
8686
| `mode` | string | No | HTML processing mode: `"normal"`, `"reader"`, or `"prune"`. Default: `"prune"` (different from Scrape/Extract, which default to `"normal"`). |
8787
| `timeRange` / `time_range` | string | No | Recency filter: `"past_hour"`, `"past_24_hours"`, `"past_week"`, `"past_month"`, `"past_year"`. |
8888
| `locationGeoCode` / `location_geo_code` | string | No | Two-letter ISO country code for localized results. Curated set (52): `ae`, `ar`, `at`, `au`, `be`, `br`, `ca`, `ch`, `cl`, `cn`, `co`, `cz`, `de`, `dk`, `eg`, `es`, `fi`, `fr`, `gb`, `gr`, `hk`, `hu`, `id`, `ie`, `il`, `in`, `it`, `jp`, `kr`, `mx`, `my`, `ng`, `nl`, `no`, `nz`, `pe`, `ph`, `pk`, `pl`, `pt`, `ro`, `ru`, `sa`, `se`, `sg`, `th`, `tr`, `tw`, `ua`, `us`, `vn`, `za`. |
89+
| `allowedTypes` / `allowed_types` | array | No | Optional non-empty MIME allowlist. Omit it to allow every supported type, including PDF. |
90+
| `processors` | array | No | Omit for the 25-page PDF cap. Send it only to override the cap; `maxPages` also defaults to 25 when omitted, and `-1` means unlimited. PDF processing costs 1 credit per page actually processed. |
8991
| `fetchConfig` / `fetch_config` | object | No | Fetch options (see [Scrape · FetchConfig](/services/scrape#fetchconfig)). |
9092
9193
<Note>
9294
Get your API key from the [dashboard](https://scrapegraphai.com/dashboard).
9395
</Note>
9496
97+
## Content Types and PDF Processing
98+
99+
By default Search accepts every supported content type, including PDFs. Use `allowedTypes` to
100+
restrict which MIME types may be fetched, and configure the PDF page cap independently with
101+
`processors`. Excluding `application/pdf` rejects PDF results even when a PDF processor is present.
102+
103+
<Note>
104+
There is no special `"all"` or `"*"` value. To allow every supported type, omit `allowedTypes`
105+
entirely. The playground follows this rule in generated snippets: when “All types” is selected, it
106+
does not print the full MIME list. If `allowedTypes` is present, it must contain at least one exact
107+
MIME type and cannot contain duplicates.
108+
</Note>
109+
110+
<CodeGroup>
111+
112+
```python Python
113+
res = sgai.search(
114+
"attention is all you need paper",
115+
num_results=5,
116+
allowed_types=["application/pdf"],
117+
processors=[{"type": "pdf", "max_pages": 10}],
118+
)
119+
```
120+
121+
```javascript JavaScript
122+
const res = await sgai.search({
123+
query: "attention is all you need paper",
124+
numResults: 5,
125+
allowedTypes: ["application/pdf"],
126+
processors: [{ type: "pdf", maxPages: 10 }],
127+
});
128+
```
129+
130+
```bash cURL
131+
curl -X POST https://v2-api.scrapegraphai.com/api/search \
132+
-H "SGAI-APIKEY: $SGAI_API_KEY" \
133+
-H "Content-Type: application/json" \
134+
-d '{
135+
"query": "attention is all you need paper",
136+
"numResults": 5,
137+
"allowedTypes": ["application/pdf"],
138+
"processors": [{"type": "pdf", "maxPages": 10}]
139+
}'
140+
```
141+
142+
</CodeGroup>
143+
144+
`allowedTypes` and `processors` must each be non-empty when provided. Set `maxPages` to `-1` to
145+
process every PDF page.
146+
147+
<Warning>
148+
The playground reserves an estimate based on `numResults` and the configured PDF page cap. PDF
149+
processing costs 1 credit per page actually processed; rejected or failed pages are not charged as
150+
successful results.
151+
</Warning>
152+
95153
## Search + Extraction
96154
97155
Combine search with AI extraction to roll results into one structured output.

0 commit comments

Comments
 (0)