How-to · AI Tools

How to Use Claude Code with the HighLevel API

Let Claude Code write the scripts for bulk updates, reports, and imports against HighLevel's API, with a safe setup and a dry-run-first habit.

What you'll do

  • Claude Code is a coding assistant that can write and run scripts that call HighLevel's API v2.
  • Authenticate with a Private Integration token kept in an environment variable, never in code.
  • Point Claude at HighLevel's official API documentation for the endpoints you need.
  • Always build a dry-run mode and test on a sandbox sub-account first.
  • Use the MCP server for chat-style tasks and scripts for repeatable or bulk jobs.

To use Claude Code with the HighLevel API, create a Private Integration token in your sub-account, store it as an environment variable on your computer, give Claude Code the relevant pages of HighLevel's API v2 documentation, and ask it to write a script for one specific task. Have it build a dry-run mode first, run that against a test sub-account, and only then run it for real.

Before you start

  • API access. HighLevel lists basic API access on the Unlimited plan and above (as of late 2026).
  • Claude Code installed and working in a project folder on your computer.
  • A Private Integration token with only the scopes your task needs. See the integrations and API tutorials for creating tokens.
  • A sandbox sub-account with test contacts.
  • A defined task, for example: "Add the tag 'vip' to every contact in this CSV of emails."

Step-by-step: set up the project

  1. Create a project folder and open Claude Code in it.
  2. Store the token in an environment variable (for example in a local .env file that is excluded from version control). Tell Claude to read it from the environment and never print it.
  3. Add a short notes file describing the HighLevel API basics Claude should follow: the API v2 base URL and required version header from HighLevel's docs, the location ID to use, and links to the endpoint pages for your task.
  4. Write the task prompt (template below).
  5. Review the plan Claude proposes before it writes code.

A prompt template that works

Goal: Read emails from vip.csv and add the tag "vip" to each matching contact in location [location ID].

API: Use HighLevel API v2 as documented at [links to the contact search and tag endpoints]. Read the token from the environment variable HIGHLEVEL_TOKEN.

Safety:

  • Default to dry-run: print what would change without calling write endpoints. Only write when run with a --live flag.
  • Throttle requests and handle rate-limit responses with retries and backoff.
  • Log every contact processed, skipped (not found), or failed to a CSV.
  • Never print or log the token.

Test: Explain how to run the dry run, then the live run on a sandbox location.

Test it

  1. Run the script in dry-run mode against the sandbox. Read the output: are the matches right?
  2. Run live against the sandbox and check a few contacts in the HighLevel UI.
  3. Open the log CSV and confirm skipped and failed rows make sense.
  4. Only then point it at the real sub-account, starting with a small slice of data.

Good first projects

TaskWhy it suits a script
Bulk tag or field updates from a spreadsheetRepetitive and easy to verify
Weekly export of new contacts or opportunities to a reportScheduled and repeatable
Cleaning up formatting in phone numbers or namesRules-based, benefits from dry-run review
Copying a list of custom fields to several sub-accountsSaves clicking through settings repeatedly

Common mistakes

  • Hard-coding the token in the script. It ends up in backups or shared repos.
  • Skipping the dry run. One wrong filter can update thousands of contacts.
  • Ignoring rate limits. Scripts that hammer the API fail halfway through. Ask for throttling and retries.
  • Letting Claude guess endpoints. Give it the official docs; APIs change.
  • Using agency-wide credentials for a single-location task. Use the narrowest token that works.

When to use MCP instead

If the job is conversational ("Which leads from last week haven't been contacted?"), the HighLevel MCP server is quicker; Claude calls tools directly from chat. Scripts are better when you want the same job to run the same way every time, or when it touches many records. See connect Claude via MCP.

What to build next

Frequently asked questions

How do I use Claude Code with external APIs like GoHighLevel?

Create a Private Integration token in HighLevel, store it as an environment variable, give Claude Code links or excerpts from HighLevel's API docs, and ask it to write a script for a specific task. Review the code and run it in dry-run mode first.

What's the best prompt for Claude to set up a GoHighLevel CRM?

Be specific: describe the outcome, the endpoints or objects involved, the data source, the safety rules (dry run, rate limiting, logging), and how to test. A vague 'set up my CRM' prompt produces vague results.

Do I need a developer to do this?

Not necessarily, but you should be comfortable running commands in a terminal and reading what a script will do before you run it. For anything touching many records, have someone experienced review it.

Should I use the MCP server or the API?

Use the MCP server when you want Claude to answer questions or take small actions conversationally. Use API scripts for repeatable jobs, bulk changes, scheduled reports, or anything you want version-controlled.