# Get join configurations for database table

`GET /api/communications/query-joins/{sourceTable}`

- **Success:** `200 OK`
- **Products:** Operator (`FOH`)
- **Features:** Front of House Generic Access (`FOHGENERIC`)

HTML version: [Get join configurations for database table](https://support.gladstonesoftware.cloud/reference/communications/get-join-configurations-for-database-table)

## Overview

Lists the joins configured for one table in the audience query builder: which other tables you may pull fields from when an audience starts from this table, and the columns each join is made on.

Audiences for communications are defined as a query over a fixed set of reporting tables — `Members`, `Subscriptions`, `Member_Consent`, `Bookings`, `Sites` and others. Only the joins configured here are permitted, so call this before offering a user a second table to filter or merge on, and use the column pairs it returns rather than inventing your own.

What comes back is configuration rather than database schema: it is maintained per tenant and a recent change to it may not appear immediately, a table with no joins configured is a normal answer rather than an error, and the set can change without the underlying schema changing.

## Endpoint

`GET {base_url}/api/communications/query-joins/{sourceTable}`

`{base_url}` is the environment URL issued to your integration. See [Authenticating with Gladstone APIs](../../guides/authenticating-with-gladstone-apis.md).

## Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `sourceTable` | string | Yes | The table the audience query starts from — for example `Members`, `Subscriptions`, `Member_Consent` or `Invoices`. Matched case-insensitively against the configured joins. A table with no joins configured, and a name that matches nothing at all, both return `200` with an empty array; you never get a `404` here, so an empty result is not proof the name was wrong. |

## Sample request

```bash title="cURL"
curl -X GET '{base_url}/api/communications/query-joins/{sourceTable}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `[].sourceTable` | string | The table you asked about, repeated on every entry. |
| `[].targetTable` | string | A table you may join to from `sourceTable`. One entry is returned per distinct target table. |
| `[].fields` | array of object | The column pairs the join is made on. Where several joins are configured between the same two tables, every pair is collapsed into this one entry rather than repeated as separate entries. |
| `[].fields[].sourceField` | string | The column on `sourceTable` to match on — for example `ID` on `Members`. |
| `[].fields[].targetField` | string | The column on `targetTable` it matches — for example `MemberID` on `Subscriptions`. |

## Sample response

```json title="200 OK"
[
  {
    "sourceTable": "string",
    "targetTable": "string",
    "fields": [
      {
        "sourceField": "string",
        "targetField": "string"
      }
    ]
  }
]
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | The `{sourceTable}` segment is empty (`Table must be specified`). An unrecognised table name does not land here — it returns `200` with an empty array. |
| `500` | Internal server error | An unexpected failure reading the join configuration. The response has no body. |
