---
title: "Explore concept connections (powered by the Signal AI Knowledge Graph)"
method: POST
path: "/affinity"
tags: ["Affinity"]
---

# Explore concept connections (powered by the Signal AI Knowledge Graph)

`POST /affinity`

This endpoint allows you to query the relationships from a source concept (entity or topic) to a set of target concepts (topics or entities) and how these relationships evolve over different months.

The `relationship.type` parameter allows you to specify the type of relationships you are interested in.
Currently, the only type of relationship supported is `proximity`

There are two ways to use this endpoint:

a. **Querying for specific concepts**: you need to provide as input a list of target-concepts IDs (`target-concepts.ids`) for known concepts that you want to query.

b. **Discovery**: when you don't specify an explicit list of target-concepts IDs, the results will be the top relationships in order of proximity to the source-concept for any given month (these entities might differ month-on-month).
You can also filter the results by concept type(s) of interest (`target-concepts.types` with values: `topic`, `entity/organisation`, `entity/people`, `entity/location`, etc.)
You can also exclude specific concepts from the results (`target-concepts.exclude.ids`).

## Request body

- PostAffinityQuery
  - `relationship` object, required
    - `type` 'proximity', required
    - `date` object, required
      - `start` string, required — A year and month encoded as `YYYY-MM` (e.g. `2023-01`)
      - `end` string, required — A year and month encoded as `YYYY-MM` (e.g. `2023-01`)
    - `interval` 'month', required
    - `limit-per-interval` integer
  - `source-concept` object, required
    - `id` string, uuid, required
  - `target-concepts` union
    - ConceptIdsObject
      - `ids` ResourceId[], required
    - unknown
    - unknown

## Response `200`

Returns a list of relationships matching the query

- PostAffinityResponse
  - `source-concept` Concept, required
    - `id` string, uuid, required
    - `type` 'entity' | 'entity/person' | 'entity/organisation' | 'entity/location' | 'entity/substance' | 'entity/disease' | 'entity/product' | 'entity/regulation' | 'topic', required
    - `name` string, required
  - `results` object[], required
    - `relationship` object, required
      - `date` string, required — A year and month encoded as `YYYY-MM` (e.g. `2023-01`)
      - `type` 'proximity', required
      - `proximity-score` number, required
      - `sentiment-score` number, required
    - `target-concept` Concept, required
      - `id` string, uuid, required
      - `type` 'entity' | 'entity/person' | 'entity/organisation' | 'entity/location' | 'entity/substance' | 'entity/disease' | 'entity/product' | 'entity/regulation' | 'topic', required
      - `name` string, required

---

[API](https://skmtc.net/signal-ai/apis/signal-ai-api.md) · [All operations](https://skmtc.net/signal-ai/apis/signal-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/signal-ai/signal-ai-api/revisions/0ab7ff186291/schema)
