Update a Parser
Modifiy an existing parser's fields. Some changes generate a new version asynchronously, others are applied immediately.
PATCH https://aiparser.scraperapi.com/parsers/{parser_id}/{version}When to use this endpoint
You have an existing parser, ran a few /parse calls, but the output isn't quite right:
A field you want is missing → use
add_fields.A field is being extracted wrong → use
modify_fieldswith clearer description.A field name is awkward → use
rename_fields.A field is no longer relevant → use
remove_fields.
You can do any combination in a single request
Request body
{
"api_key": "API_KEY",
"add_fields": [
{ "name": "products.discount", "description": "Discount percentage as a number", "type": "number" }
],
"modify_fields": [
{ "name": "price", "description": "Price in USD as a number, no currency symbol", "type": "number" }
],
"rename_fields": [
{ "name": "products.name", "new_name": "products.title" }
],
"remove_fields": ["obsolete_field"]
}Only api_key is required. Include only the operations you need.
Response
200 OK
Only rename_fields and/or remove_fields were sent - changes apply immediatelly.
New version number
202 Accepted
add_fields or modify_fields were sent - a new version is generating asynchronously.
New version number
Step-by-step Example
Suppose you create a parser and you get version: 0, but notice that the price field is being returned as string that includes the $ symbol. Here's how you would clean up the field and update the parser, so the price is returned in a more usable numeric format:
Field definition reference
Each entry in add_fields and modify_fields supports
name
Yes
Field name. Use dot notation for nested fields (e.g. products.images.url)
description
Yes
Field description. The more specific - the better the results.
type
No
string, number or array.
selector
No
CSS or XPATH selector.
selectors are optional, but they often produce more reliable results.
Last updated

