Skip to main content
Ця сторінка також доступна українською.

Overview

The new Connections endpoint provides a single API call to retrieve all of a user’s connected services — Google Ads accounts and Google Business Profile (GBP) locations — grouped by company. Before: the frontend had to call separate endpoints for Google Ads customers and GBP locations, often repeating requests per company (N+1 problem). After: one GET /api/v1/companies/me/connections call returns everything.

Endpoints

EndpointReturnsUse case
GET /api/v1/companies/me/connectionslist[CompanyWithConnections]Dashboard / sidebar — fetch all connections across all companies at once
GET /api/v1/companies/me/{company_id}/connectionsCompanyWithConnectionsCompany detail page — fetch connections for a specific company
Both require a valid Authorization: Bearer <token> header.

Response format

Both endpoints return the same shape — a company object with two connection arrays. The “all connections” endpoint wraps it in a list.

CompanyWithConnections

id
integer
required
The company ID.
name
string
required
The company name.
date_added
string (ISO 8601)
required
When the company was created.
date_updated
string (ISO 8601)
required
When the company was last updated.
google_ads_customers
GoogleAdsCustomer[]
required
Connected Google Ads accounts. Empty array if none.
google_business_locations
GoogleBusinessLocation[]
required
Connected GBP locations. Empty array if none.

Example request and response

curl -X GET "https://api.cattix.com/api/v1/companies/me/connections" \
  -H "Authorization: Bearer YOUR_TOKEN"
Response (200 OK):
[
  {
    "id": 1,
    "name": "My Agency",
    "date_added": "2025-06-15T10:30:00",
    "date_updated": "2025-12-01T14:22:00",
    "google_ads_customers": [
      {
        "id": 1234567890,
        "descriptive_name": "Client Store",
        "currency_code": "USD",
        "time_zone": "America/New_York",
        "status": "ENABLED",
        "manager": false,
        "date_added": "2025-07-01T09:00:00",
        "date_updated": "2025-11-20T08:15:00",
        "is_active": true,
        "is_deleted": false
      }
    ],
    "google_business_locations": [
      {
        "id": "locations/abc123",
        "title": "Client Store — Downtown",
        "store_code": "STORE-001",
        "maps_uri": "https://maps.google.com/?cid=123456",
        "storefront_address": {
          "region_code": "US",
          "language_code": "en",
          "postal_code": "10001",
          "administrative_area": "NY",
          "locality": "New York",
          "sublocality": null,
          "address_lines": ["123 Main St"]
        }
      }
    ]
  },
  {
    "id": 2,
    "name": "Side Project",
    "date_added": "2025-09-10T12:00:00",
    "date_updated": "2025-09-10T12:00:00",
    "google_ads_customers": [],
    "google_business_locations": []
  }
]
Companies with no connections still appear in the response — their google_ads_customers and google_business_locations arrays are empty. This lets you show “No connections yet” UI without extra logic.

Single-company endpoint

To fetch connections for a specific company, use the company ID in the path:
curl -X GET "https://api.cattix.com/api/v1/companies/me/42/connections" \
  -H "Authorization: Bearer YOUR_TOKEN"
Returns a single object (not an array):
{
  "id": 42,
  "name": "My Agency",
  "date_added": "2025-06-15T10:30:00",
  "date_updated": "2025-12-01T14:22:00",
  "google_ads_customers": [ ... ],
  "google_business_locations": [ ... ]
}

What gets filtered out

The backend automatically excludes inactive or deleted resources. You do not need to filter on the frontend side. The following are excluded:
Excluded when…Example
Company is soft-deletedCompany was removed by admin
User membership is inactiveUser was removed from a company
Connection link is inactiveGoogle Ads account was unlinked
Resource itself is inactive / deletedGoogle Ads account was suspended

Caching

Responses are cached on the backend (Redis). You do not need to implement any caching logic on the frontend. The cache is automatically invalidated when:
  • A company is created, updated, or deleted
  • A member is added to or removed from a company
  • A Google Ads account or GBP location is linked / unlinked
This means calling the endpoint after any mutation will return fresh data.

Migration guide

If you are currently fetching Google Ads customers and GBP locations from separate endpoints:
1

Replace multiple calls with one

Replace individual calls to Google Ads and GBP endpoints with a single call to GET /api/v1/companies/me/connections.
2

Update your data model

The response groups connections under each company. Map your UI state accordingly:
interface CompanyWithConnections {
  id: number;
  name: string;
  date_added: string;
  date_updated: string;
  google_ads_customers: GoogleAdsCustomer[];
  google_business_locations: GoogleBusinessLocation[];
}

// The "all connections" endpoint returns:
type AllConnections = CompanyWithConnections[];
3

Remove client-side filtering

The backend already filters out inactive / deleted resources. Remove any frontend is_active / is_deleted checks.
4

Remove client-side caching (optional)

If you had client-side caching for connection data, it can be simplified or removed since the backend now caches the response.