PUT /v2/indices/{index public key}/documents/{document id}

Update existing document, or create a new document with predefined URL or ID.

{
  "custom_fields": {
    "title": "Example product",
    "description": "Description for example product",
    "price_cents": 599,
    "average_customer_rating": 4.5
  }
}
FieldDescriptionTypeNotes
custom_fieldsTop levelA map of custom fields key value pairsSupported data-types: text, integer, and double.

PUT /v2/indices/{index public key}/documents/

Omit the document id in the URL of the request if you include either a document id or a “url” field in the document content.

{
  "url": "https://www.example.com/",
  "id": "8700a03070a37982924597d6baa87be7",
  "custom_fields": {
    "title": "Example product",
    "description": "Description for example product",
    "price_cents": 599,
    "average_customer_rating": 4.5
  }
}
FieldDescriptionTypeNotes
urlDocument's URLstring
idDocument's idstringURL encoded as md5 hash.
custom_fieldsTop levelA map of custom fields key value pairs.Supported data-types: text, integer, and double.

If the URL does not contain the document id, the id of the document will be resolved to either:

  1. “id” field present in the document; or if the “id” is not present the
  2. a md5 checksum of the “url” field in the document

Document fields

FieldDescriptionTypeNotes
urlDocument's URLstring
idDocument's IDstringURL encodeed as md5 hash.
languageDocument's languagestring
titleDocument's titletextThe document's title as defined in the HTML title tag.
main_contenttextThe text content of the page.
custom_fieldsTop levelA map of custom fields key value pairsSupported data-types: text, integer, and double.

The supported data types for the custom fields are:

  • text
  • integer
  • double

Dates should be defined as UNIX timestamps with integer values.

Please note that once you have defined a specific data type for the custom field, the data type cannot be changed.

Indexing unsupported values will fail. If you have defined an unsupported data type, create a new custom field with a different name.

Response

On successful queuing of the update, the endpoint returns an HTTP 202. Please note that it might take a few seconds for the changes to become available.

Was this helpful?

Need more help?
We're always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team.