# Create Google integration

POST https://services.leadconnectorhq.com/ad-publishing/google/integration

Create a Google Ads integration for a location

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `adPublishing.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-04-15"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/ad-publishing/google/integration": {
      "post": {
        "summary": "Create Google integration",
        "operationId": "createGoogleIntegration",
        "description": "Create a Google Ads integration for a location",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-04-15"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGoogleIntegrationDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored integration. Returns the raw document, so the id is `_id`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoogleCreateIntegrationResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "adPublishing.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "CreateGoogleIntegrationDTO": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Location identifier",
            "example": "loc_abc123"
          },
          "adAccountId": {
            "type": "string",
            "description": "Ad account identifier",
            "example": "123-456-7890"
          },
          "mccId": {
            "type": "string",
            "description": "MCC identifier",
            "example": "987-654-3210"
          }
        },
        "required": [
          "locationId",
          "adAccountId",
          "mccId"
        ],
        "title": "CreateGoogleIntegrationDTO"
      },
      "GoogleCreateIntegrationResponseDTO": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Integration identifier, as `_id` rather than `id`",
            "example": "677ebaed998e79ec25fc612b"
          },
          "__v": {
            "type": "number",
            "description": "Mongoose internal version key",
            "example": 0
          },
          "locationId": {
            "type": "string",
            "description": "Location identifier",
            "example": "fRMewNQIxSyZ5R4nQyit"
          },
          "status": {
            "type": "string",
            "description": "Connection state",
            "enum": [
              "connected",
              "expired",
              "disconnected"
            ],
            "example": "connected"
          },
          "adAccountId": {
            "type": "string",
            "description": "Connected Google Ads customer id",
            "example": "6776452901"
          },
          "mccId": {
            "type": "string",
            "description": "Manager (MCC) customer id above the account",
            "example": "6776452901"
          },
          "userId": {
            "type": "string",
            "description": "Google People API resource name of the connected user",
            "example": "people/1154723318699"
          },
          "connectionId": {
            "type": "string",
            "description": "Identifier of the OAuth connection backing this integration",
            "example": "gZddldBd8SWA7C"
          },
          "createdAt": {
            "type": "string",
            "description": "Created at",
            "example": "2025-01-08T17:50:37.952Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "Updated at",
            "example": "2026-08-19T08:12:05.304Z"
          }
        },
        "required": [
          "_id",
          "__v",
          "locationId",
          "status",
          "adAccountId",
          "mccId",
          "userId",
          "connectionId",
          "createdAt",
          "updatedAt"
        ],
        "title": "GoogleCreateIntegrationResponseDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for an unexpected server error",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the server failure",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/ad-publishing/google/integration' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-04-15' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "loc_abc123",
  "adAccountId": "123-456-7890",
  "mccId": "987-654-3210"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2021-04-15',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "loc_abc123",
      "adAccountId": "123-456-7890",
      "mccId": "987-654-3210"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/google/integration', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/ad-publishing/google/integration"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2021-04-15"
}

payload = {
    "locationId": "loc_abc123",
    "adAccountId": "123-456-7890",
    "mccId": "987-654-3210"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/ad-publishing/google/integration',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-04-15',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "loc_abc123",
  "adAccountId": "123-456-7890",
  "mccId": "987-654-3210"
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/ad-publishing/google/integration")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-04-15")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"loc_abc123\",\"adAccountId\":\"123-456-7890\",\"mccId\":\"987-654-3210\"}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/ad-publishing/google/integration"
  payload := strings.NewReader(`{
  "locationId": "loc_abc123",
  "adAccountId": "123-456-7890",
  "mccId": "987-654-3210"
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-04-15")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/ad-publishing/google/integration")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2021-04-15"
request["Content-Type"] = "application/json"
request.body = '{
  "locationId": "loc_abc123",
  "adAccountId": "123-456-7890",
  "mccId": "987-654-3210"
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2021-04-15"
}

$body = '{
  "locationId": "loc_abc123",
  "adAccountId": "123-456-7890",
  "mccId": "987-654-3210"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ad-publishing/google/integration' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
