Galya Docs
API referencererank

Rerank a provided candidate set by taste affinity

POST
/rerank

Reranks a caller-supplied list of content objects by affinity relative to the taste profile of a specified entity. Unlike /search, no graph lookup is performed — the candidate set is entirely caller-provided. Candidates are not persisted after the call. With history (+ item_texts), scores via personalized history rerank. Pass domain=uiux to use the UI/UX history model; otherwise the default catalog model. Without history, uses the cluster / affinity graph path. For two-tower recommendations, use POST /recommend.

Authorization

ApiKeyAuth
X-API-Key<token>

In: header

Query Parameters

relative_to_entity_id*string

The entity whose taste profile is used to rank the candidates.

in_terms_of_entity_type*string

The entity type context for affinity scoring.

Value in"content" | "place" | "brand" | "user" | "website" | "file"
domain?string

When set to uiux with history, uses the UI/UX history rerank model.

Value in"uiux"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/rerank?relative_to_entity_id=string&in_terms_of_entity_type=content" \  -H "Content-Type: application/json" \  -d '{    "candidates": [      {        "url": "http://example.com",        "type": "image",        "domain": "restaurants"      }    ]  }'
{
  "results": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "url": "http://example.com",
      "ref": "string",
      "type": "content",
      "linked_content": [
        {
          "id": "string",
          "title": "string",
          "description": "string",
          "url": "http://example.com",
          "content": "string",
          "skip_url_fetch": false,
          "skip_media_enrich": false,
          "type": "image",
          "domain": "restaurants",
          "ref": "string"
        }
      ],
      "linked_entities": [
        {
          "id": "string",
          "name": "string",
          "description": "string",
          "url": "http://example.com",
          "ref": "string",
          "type": "content",
          "linked_content": [
            {
              "id": "string",
              "title": "string",
              "description": "string",
              "url": "http://example.com",
              "content": "string",
              "skip_url_fetch": false,
              "skip_media_enrich": false,
              "type": "image",
              "domain": "restaurants",
              "ref": "string"
            }
          ],
          "linked_entities": []
        }
      ]
    }
  ]
}
{
  "error": "string",
  "code": "string"
}
{
  "error": "string",
  "code": "string"
}