Skip to content

Update API

Use POST /api/update after publishing or changing a page on your website. Dzen Chat creates or refreshes its page record and queues the URL for crawling and indexing. The page does not need to be indexed already, but its URL must belong to a source assigned to the authenticated API client.

This method accepts a URL, not page content. To submit text directly, use the Files API. Read authentication for API client setup.

Request

POST /api/update
Authorization: Bearer CLIENT_ID.CLIENT_SECRET
Content-Type: application/json

{
  "url": "https://example.com/help/"
}
JSON field Required Description
url Yes Absolute HTTP or HTTPS URL of a page belonging to an assigned source.

202 Accepted means Dzen Chat created or refreshed the page record and queued the existing crawler lifecycle. It does not mean indexing has already finished.

{
  "status": "ok",
  "action": "queued",
  "url": "https://example.com/help/",
  "final_url": null,
  "message": "Page update queued"
}

The same URL can be submitted again to request reprocessing. If its host is not covered by a source assigned to the client, the response is 403:

{
  "error": "URL is outside assigned sources"
}

curl

Replace the instance URL and client credentials with your own values. Run this from your server or terminal, keeping the token out of browser code:

export DZEN_CHAT_URL='https://chat.example.com'
export DZEN_API_TOKEN='CLIENT_ID.CLIENT_SECRET'

curl --fail-with-body --request POST "$DZEN_CHAT_URL/api/update" \
  --header "Authorization: Bearer $DZEN_API_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{"url":"https://example.com/help/"}'

Python

This example uses the Python standard library and the same environment variables:

import json
import os
from urllib.request import Request, urlopen

request = Request(
    os.environ["DZEN_CHAT_URL"].rstrip("/") + "/api/update",
    data=json.dumps({"url": "https://example.com/help/"}).encode("utf-8"),
    headers={
        "Authorization": "Bearer " + os.environ["DZEN_API_TOKEN"],
        "Content-Type": "application/json",
    },
    method="POST",
)
with urlopen(request, timeout=30) as response:
    print(response.status)  # 202: queued, not finished
    print(json.load(response))

urlopen raises HTTPError for unsuccessful HTTP responses. A client timeout alone does not establish whether the server queued the request.

Processing and errors

The response contains no completed crawl result or page ID. final_url is null when the work is queued. Use Pages API to inspect the page's indexing state after processing; do not treat 202 as a successful crawl. Submitting the same URL again requests reprocessing and does not restore a manually excluded page.

Status Meaning
202 The URL was queued for crawling.
401 Missing or invalid API client bearer token.
403 URL outside assigned sources, or an existing page belongs to another source the client cannot access. Integration clients are also restricted to their active integration's site.
409 The URL was manually excluded from indexing. Restore it through the project's exclusion controls before requesting an update.
422 Invalid request body, including a missing URL or a URL that is not HTTP/HTTPS.

For an excluded URL, the response is:

{"error": "URL is excluded from indexing"}

The request does not accept a project selector: the API client determines the project and permitted sources.