Migrating from Legacy API

The legacy DQL endpoint, https://kg.diffbot.com/kg/dql_endpoint was deprecated in Q4 2022. It continues to work but new features and performance improvements are only added to the new v3 API. The new API is also more aligned with other KG APIs like Enhance. We strongly encourage users to use the new API.

The following things have changed in the new API:

  1. The new endpoint is now https://kg.diffbot.com/kg/v3/dql
  2. The response format has slightly changed. In the legacy API response, the entities were directly under the data array like so:
    {
      "version": 1,
      "hits": 1,
      "kgversion": "318",
      "data": [
        {
           "id": "...",
           "name": "...",
           ...
        },
        {
           "id": "...",
           "name": "...",
           ...
        },
      ]
    }
    
    In the new API response, entities are under the data[].entity element with additional metadata about the result. Example:
    {
      "version": 3,
      "hits": 1,
      "kgversion": "318",
      "data": [
        {
          "score": 1.0,
          "entity": {
            "id": "...",
            "name": "...",
            ...
          },
          "entity_ctx": {
            "matched_clauses": []
          }
        },
        {
          "score": 1.0,
          "entity": {
            "id": "...",
            "name": "...",
            ...
          },
          "entity_ctx": {
            "matched_clauses": []
          }
        }
      ]
    }