API Index

This guide walks you through the new API Index type of source, that allows you to send content via API unlocking full control over your indexes

Introduction

Use the API Index to push answers directly via API using your Index UID and an API Key. This gives you full control over what goes into your index and when it changes.

  • Base route:

    https://api.raffle.ai/v2/indexes/
    
  • Index UID: the unique id of your index (visible in the product UI). You will reference it in every endpoint as {index_uid}.

For the most up to date technical documentation, refer to the API Reference.

Available parameters

You can set different parameters:

  1. title, that will be the title displayed in search result
  2. content, a section of the content will be displayed as the search result description
  3. source_url, where the search results links to
  4. last_modified, a date you can use to influence the result ranking (optional)

Check the Answer Schema section below.

Available parameters

Prerequisites

  1. Create an API Key in API Keys (the secret is shown only once).

  2. Use the header on every request:

    X-API-Key: <your-api-key>
    

Endpoints

GET

/answers — List answers {#get-answers}

GET https://api.raffle.ai/v2/indexes/{index_uid}/answers

Query parameters

Parameter Type Description
limit int Number of results (default: 10)
after-uid string Pagination cursor

Response

{
  "answers": [
    {
      "uid": "answer-123",
      "title": "Example Answer",
      "content": "<p>Content here</p>"
    }
  ]
}

PUT

/answers/{answer_uid} — Upsert (create or update) {#put-answer}

PUT https://api.raffle.ai/v2/indexes/{index_uid}/answers/{answer_uid}

Purpose

This endpoint both creates new answers and updates existing ones based on the answer_uid you provide.

Path parameters

Parameter Type Description
answer_uid string Stable unique answer identifier

Request body

Field Type Required
title string Required
content string (HTML) Required
source_url string Required
last_modified string (ISO 8601) Optional

Why upsert?

Most teams already maintain content in a database or external system. Reusing your system’s stable id keeps mapping trivial. When creating, pass a stable id as answer_uid — e.g., your DB entity id, a UUID you generate, or the source_url. One of those should be used as the id you send.

Response

HTTP/1.1 204 No Content

DELETE

/answers/{answer_uid} — Delete an answer {#delete-answer}

DELETE https://api.raffle.ai/v2/indexes/{index_uid}/answers/{answer_uid}

Path parameters

Parameter Type Description
answer_uid string Unique answer identifier

Answer Schema

Field Type Notes
uid string Unique answer id
title string Required
content string (HTML) Required
source_url string Optional
last_modified string (ISO 8601) Optional

Errors

Standardized error payload:

{
  "code": 401,
  "message": "Invalid API Key"
}

Read more about Api-Index in the API Reference.