API Reference

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
  }
}

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

Omit the document id in the URL 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
  }
}

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

  • url: optional, the URL of the document
  • id: optional, a unique identifier for the document
  • custom_fields: optional, a map of key value pairs for custom fields

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.

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.