# Project context and data API reference

Read project context, published synchronization mappings, flow YAML, and snippet freshness.

Available on the Scale and Pro plans.

These read endpoints expose project context for reporting and assistant workflows. They do not share one configuration source: context uses live configuration, synchronization uses stable configuration, and flow YAML uses the latest configuration record.

## Authentication and limits

Paths below follow `https://api.rightmessage.com/v1/{teamPid}`. Every operation is GET and accepts `read`, `write`, or `*`. The [shared request conventions](https://rightmessage.com/help/rest-api-overview#base-url-and-authentication) cover bearer authentication, headers, project access, and rate limits.

There is no pagination contract. Shared failures include 401, 403, 404 for an unknown project, 429, and maintenance 503. Service failures can return 500. None of these operations publishes configuration.

## GET /data/context

Returns saved project context and recent segment counts for reporting or an AI assistant.

Optional query `no_cache` is converted to a boolean, default false. Values `1`, `true`, `on`, and `yes` are true. There is no field-level request validation. True bypasses the context-cache read, then stores the refreshed result.

Returns 200 with `data.ai_context`, the project's saved AI-context value, and `data.segment_counts`, an array of groups. Each group contains `id`, `name`, nullable `question`, and `segments`. Each segment contains `id`, `name`, numeric `count`, and string-array `otherAnswers`.

Counts use the last 30 days through the current UTC day. Group membership comes from live published configuration. The response includes up to 1,000 recent free-text responses grouped by segment. This is not an unrestricted export. Cached context lasts one hour and is tied to the live configuration. The route does not accept an AI prompt or generate an AI completion.

A segment count is the unique-visitor estimate from the audience query, not the number of answers submitted. The query has a 10,000-segment bucket limit; a configured segment absent from those buckets is displayed as zero. The displayed question is the first question linked to that group. A zero is not proof that a question was never answered.

Illustrative request and response, not executed:

```http
GET /v1/123456/data/context?no_cache=true HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
```

```json
{"data":{"ai_context":null,"segment_counts":[{"id":"dim_example1","name":"Team type","question":"What kind of team uses WorkForge?","segments":[{"id":"seg_example1","name":"Agency","count":25,"otherAnswers":[]}]}]}}
```

The sample count is fictional. `ai_context` is returned as stored; clients must not assume it is always an object.

## GET /data/dimension-sync

Returns published custom-field synchronization mappings for segment groups.

No parameters. Returns 200 with a `data` array from stable configuration. No stable configuration produces `[]`.

A group is included only when it has both a synchronization platform and a custom field. Its response keys are case-sensitive:

| Key              | Value                                                                                           |
| ---------------- | ----------------------------------------------------------------------------------------------- |
| `dimensionId`    | Group ID                                                                                        |
| `Name`           | Stored group name; capital N is intentional                                                     |
| `fieldName`      | Stored custom-field identifier                                                                  |
| `syncTo`         | Provider name                                                                                   |
| `questionText`   | Related question text with HTML removed and phrase fallbacks rendered, or null                  |
| `segments`       | Array of `segmentId`, `name`, and `fieldValue` objects. Only non-null sync values are included. |
| `hasOtherOption` | Boolean                                                                                         |
| `otherFieldName` | Other-answer custom field or null                                                               |

Tag-only groups without a custom field are omitted, as are direct input-question mappings that do not belong to an included group. Tag-mode values, empty strings, and `"0"` values are excluded. This is a view of configured mappings, not proof that a provider accepted a sync. The response does not include Liquid template examples.

Illustrative request and response, not executed:

```http
GET /v1/123456/data/dimension-sync HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
```

```json
{"data":[{"dimensionId":"dim_example1","Name":"Team type","fieldName":"team_type","syncTo":"convertkit","questionText":"What kind of team uses WorkForge?","segments":[{"segmentId":"seg_example1","name":"Agency","fieldValue":"Agency"}],"hasOtherOption":false,"otherFieldName":null}]}
```

## GET /data/flows/{flowId}

Returns a readable YAML description of a flow and its recorded metrics.

`flowId` is the stored flow ID. Query `days` is cast to an integer and defaults to 30. There is no request-level minimum, maximum, or integer validation. Query `include_paths` is converted to a boolean and defaults false.

Returns 200 with `data.flow_id`, `data.format: "yaml"`, and `data.content`, a YAML string. Content describes the flow, node UUIDs, connections, resource IDs, synchronization context, and available metrics. `include_paths` adds the path overview.

The generator reads the latest configuration record, which can be a draft. Its attached analytics still describe recorded activity. This is not a published-only snapshot. The YAML includes a reading guide: `trunk_next` is the normal continuation, an answer's `next` can override it, and `(flow-end)` marks termination.

No configuration returns 404 with `message: "No configuration found"`; a missing flow returns 404 with `message: "Flow not found"`.

Illustrative request, not executed:

```http
GET /v1/123456/data/flows/ofn_example1?days=30&include_paths=true HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
```

Illustrative response excerpt, not a complete YAML document:

```json
{"data":{"flow_id":"ofn_example1","format":"yaml","content":"# Flow: WorkForge welcome\n#\n# Flow YAML reading guide:\n"}}
```

## GET /data/status

Returns the last recorded snippet-data update and whether it is stale.

No parameters. Returns 200 with nullable string `data.last_update` and boolean `data.stale`. Stale is true only when a non-null last update is more than seven days old. A null last update produces false, not a confirmed healthy state.

The reporting service returns null for missing data and for caught lookup failures. Therefore `{"last_update":null,"stale":false}` does not prove that the snippet is active or that no data ever arrived.

This GET can also mark a project with an owner as having received its first snippet data. It does not change or publish the draft.

Illustrative request and response, not executed:

```http
GET /v1/123456/data/status HTTP/1.1
Host: api.rightmessage.com
Authorization: Bearer YOUR_API_TOKEN
Accept: application/json
```

```json
{"data":{"last_update":"2026-10-13T11:59:00Z","stale":false}}
```
