# Connect a location with a listing of a connected account

```http
POST https://api.synup.com/api/v4/connected-accounts/connect-listing
```

This API links a location in your account with a listing from a connected Google My Business or Facebook Page account.

**Required Fields:**
- locationId – Base64-encoded unique identifier of the location.
- connectedAccountListingId – The ID of the listing, retrieved from the Fetch Listings API.
- connectedAccountId – The ID of the connected account managing the listing.

**Behavior:**
- Establishes a direct connection between the location and the listing.
- Enables the system to sync and manage the listing’s data.

Source: https://developer.synup.com/api/connected-accounts/connect-a-location-with-a-listing-of-a-connected-account

## Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Content-Type` | string | required |  |

## Request body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `input` | object | required |  |
| `input.locationId` | string | required | Base64 encoded location ID |
| `input.connectedAccountId` | string | required | ID of the connected account |
| `input.connectedAccountListingId` | string | required | ID of the listing from the fetch listings API response. This is typically a base64 encoded string. |

## Example request

```bash
curl -X POST 'https://api.synup.com/api/v4/connected-accounts/connect-listing' \
  -H 'Authorization: API YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "input": {
    "locationId": "TG9jYXRpb246NzM5MzM=",
    "connectedAccountId": "3db66afa-151d-4212-a8b7-949f9fe9aaf9",
    "connectedAccountListingId": "R21iQnVsa0RhdGFMYWtlOmMyMWRiOWY5LTZmYTctNDE0My1hNDU2LTQzMjZkMmZiN2UwZg=="
  }
}'
```

## Responses

| Status | Description |
| --- | --- |
| `200` | Connection process completed |
| `400` | Invalid request - Malformed base64 string or invalid IDs |
| `401` | Unauthorized - Invalid or missing API key |
| `403` | Forbidden - Insufficient permissions |
| `404` | Not Found - Location or listing not found |
