# create location from connected account listing

```http
POST https://api.synup.com/api/v4/connected-accounts/create-location-from-listing
```

This API creates a new location in the system from an existing connected account listing (Google My Business or Facebook page) that has been previously fetched and stored in the bulk data lake.
What This API Does:
Takes a listing from your connected account's bulk data (Google or Facebook)
Fetches the latest information from the platform (Google/Facebook API)
Creates a new location in Synup with all the business details
Automatically links the location to the connected account
Important Prerequisites:
You must already have a connected account (Google or Facebook) with valid credentials
The account must have completed the bulk listing fetch process
The listing must be available in the bulk data lake (not yet connected to a location)
The listing must belong to the specified connected account
Request Parameters:
connectedAccountId (required): UUID of your connected Google/Facebook account
connectedAccountListingId (required): Encoded ID of the listing from bulk data (format: GmbBulkDataLake:xxx or FbBulkDataLake:xxx)
tenure (optional): Billing tenure for the location (e.g., "Monthly", "Yearly")
API Behavior:
For Google My Business: Fetches latest location data including name, address, hours, categories, phone, photos, and attributes
For Facebook: Fetches latest page data including name, location, hours, categories, description, and contact info
Validates that credentials are still valid before proceeding
Checks if the listing is already connected to prevent duplicates
Creates location with proper state mapping (uses reverse geocoding for Facebook if needed)
Response:
On success: Returns success: true with the new location_id (database ID)
On failure: Returns success: false with error code and message
Common Error Codes:
SY81019: User not found (authentication issue)
SY81066: Connected account not found or archived
SY81067: Invalid listing ID format
SY81068: Listing already connected to another location
SY81069: Connected account credentials are invalid (need to reconnect)
SY81070: Listing doesn't belong to the specified connected account
SY81071: Unexpected error during location creation
Post-Creation:
Location is automatically linked to the connected account
Background worker processes additional tasks (connection records, etc.)
Location becomes available for management and submission

Source: https://developer.synup.com/api/connected-accounts/create-location-from-connected-account-listing

## Header parameters

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

## Request body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `input` | object | optional |  |
| `input.errorUrl` | string | required | Redirect URL in case of Error |
| `input.successUrl` | string | required | Redirect URL in case of Success |

## Example request

```bash
curl -X POST 'https://api.synup.com/api/v4/connected-accounts/create-location-from-listing' \
  -H 'Authorization: API YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "input": {
    "connectedAccountId": "e9c587ea-ae1c-416f-8824-ef4185cd2c99",
    "connectedAccountListingId": "R21iQnVsa0RhdGFMYWtlOjU3NzU5MzRiLTUwOTgtNGQwYS04YjQ0LTNjY2ZlZmZkZmUzNw==",
    "tenure": "Monthly"
  }
}'
```

## Responses

| Status | Description |
| --- | --- |
| `200` | Successfully generated connection URL |
| `400` | Bad request - invalid input |
