{"id":51103012,"url":"https://github.com/robzolkos/gohighlevel","last_synced_at":"2026-06-24T12:30:57.773Z","repository":{"id":358122819,"uuid":"1238780084","full_name":"robzolkos/gohighlevel","owner":"robzolkos","description":"Ruby SDK for the HighLevel (GoHighLevel) API","archived":false,"fork":false,"pushed_at":"2026-06-11T18:39:19.000Z","size":315,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-11T20:13:47.920Z","etag":null,"topics":["api-client","crm","gohighlevel","highlevel","ruby","ruby-gem","sdk"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robzolkos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-14T12:54:08.000Z","updated_at":"2026-06-11T18:39:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/robzolkos/gohighlevel","commit_stats":null,"previous_names":["robzolkos/gohighlevel"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/robzolkos/gohighlevel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzolkos%2Fgohighlevel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzolkos%2Fgohighlevel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzolkos%2Fgohighlevel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzolkos%2Fgohighlevel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robzolkos","download_url":"https://codeload.github.com/robzolkos/gohighlevel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robzolkos%2Fgohighlevel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34733256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","crm","gohighlevel","highlevel","ruby","ruby-gem","sdk"],"created_at":"2026-06-24T12:30:55.433Z","updated_at":"2026-06-24T12:30:57.764Z","avatar_url":"https://github.com/robzolkos.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gohighlevel\n\nA Ruby SDK for the [HighLevel](https://highlevel.com) (GoHighLevel) API.\n\n- Resource methods generated from the official OpenAPI spec — 40 apps, 700+ endpoints.\n- Runtime behaviour (auth resolution, OAuth refresh, webhook verification) hand-written and tested against the canonical docs.\n- Faraday 2 transport, Zeitwerk loader, immutable per-client configuration — no global mutable state.\n- Ruby 3.3+.\n\n## Installation\n\n```ruby\n# Gemfile\ngem \"gohighlevel\"\n```\n\n```sh\nbundle add gohighlevel\n```\n\nThe storage-backend gems (`redis`, `activerecord`, `mongo`) are **not** runtime dependencies — add whichever you need to your own `Gemfile`. The default in-memory store needs nothing.\n\n## Quickstart\n\n```ruby\nrequire \"gohighlevel\"\n\nclient = HighLevel::Client.new(private_integration_token: \"pit-xxxxxxxx\")\n\n# Every app is a resource on the client.\ncontacts = client.contacts.search_contacts_advanced(\n  body: { locationId: \"loc-123\", pageLimit: 20 }\n)\n\ntasks = client.contacts.get_all_tasks(contact_id: \"contact-456\")\n```\n\nResource method names are the spec's `operationId` in snake_case. Path parameters are required keyword arguments; query parameters are optional keyword arguments; a request body (when the endpoint declares one) is the `body:` keyword argument.\n\n## Authentication\n\n`HighLevel::Client.new` accepts one of four credential modes. Configuration is immutable and per-instance.\n\n```ruby\n# 1. Private Integration Token — simplest, always wins when present.\nHighLevel::Client.new(private_integration_token: \"pit-xxxx\")\n\n# 2. Agency access token.\nHighLevel::Client.new(agency_access_token: \"agency-xxxx\")\n\n# 3. Location access token.\nHighLevel::Client.new(location_access_token: \"loc-xxxx\")\n\n# 4. OAuth app credentials — required for the OAuth flows + 401 refresh.\nHighLevel::Client.new(client_id: \"xxxx\", client_secret: \"xxxx\")\n```\n\nYou can also pass a prebuilt `HighLevel::Configuration`:\n\n```ruby\nconfig = HighLevel::Configuration.new(\n  private_integration_token: \"pit-xxxx\",\n  api_version: \"2021-07-28\",\n  session_storage: HighLevel::Storage::Memory.new,\n  instrumenter: ActiveSupport::Notifications\n)\nHighLevel::Client.new(config)\n```\n\nFor OAuth-secured endpoints, the SDK resolves the right token per request from the operation's declared security requirements (`Agency-Access`, `Location-Access`, `bearer`, ...), falling back to session storage when no direct token is configured.\n\n### OAuth flows\n\n```ruby\nclient = HighLevel::Client.new(\n  client_id: \"xxxx\",\n  client_secret: \"xxxx\",\n  redirect_uri: \"https://your.app/oauth/callback\"\n)\n\n# 1. Send the user here to authorize.\nurl = client.oauth.authorization_url(scope: \"contacts.readonly contacts.write\")\n\n# 2. Exchange the code that comes back on your callback.\ntokens = client.oauth.exchange_code(code: params[:code], user_type: \"Location\")\n\n# 3. Refresh later.\ntokens = client.oauth.refresh_token(refresh_token: stored_refresh, user_type: \"Location\")\n\n# 4. Derive a location token from an agency token.\ntokens = client.oauth.get_location_access_token(company_id: \"co-1\", location_id: \"loc-1\")\n```\n\nWhen a request returns `401`, the SDK transparently attempts a refresh (using the session in storage), retries once, and — for location tokens — falls back to re-deriving from the company token. A second `401` is propagated, not looped.\n\n## Storage backends\n\nSession storage holds OAuth tokens keyed by resource (company/location) id. `HighLevel::Storage::Memory` is the default and needs no configuration.\n\n| Backend | When to use | Extra gem |\n|---|---|---|\n| `Storage::Memory` | Tests, single-process apps | — (default) |\n| `Storage::ActiveRecord` | Rails apps with an existing database | `activerecord` |\n| `Storage::Redis` | Multi-process workers sharing tokens | `redis` |\n| `Storage::Mongo` | Parity with TS SDK consumers sharing a Mongo store | `mongo` |\n\n```ruby\n# Redis\nstore = HighLevel::Storage::Redis.new(url: \"redis://localhost:6379/0\")\nHighLevel::Client.new(client_id: \"x\", client_secret: \"y\", session_storage: store)\n\n# ActiveRecord — once, in a migration:\nHighLevel::Storage::ActiveRecord::Migration.create_table!(connection)\nstore = HighLevel::Storage::ActiveRecord.new\n```\n\nAll backends satisfy the same contract (`test/support/session_storage_contract.rb`). Writing your own: subclass `HighLevel::Storage::Base` and implement the seven methods.\n\n## Webhook verification\n\nHighLevel signs webhooks with its private key and publishes the public key — verification is asymmetric, not HMAC. Two schemes are supported: `:rsa` (signature on the `x-wh-signature` header) and `:ed25519` (`x-ghl-signature`).\n\n```ruby\n# Sinatra\npost \"/webhooks/highlevel\" do\n  body = request.body.read\n  HighLevel::Webhooks.verify(\n    payload: body,\n    signature: request.env[\"HTTP_X_WH_SIGNATURE\"],\n    public_key: ENV.fetch(\"HIGHLEVEL_WEBHOOK_PUBLIC_KEY\"),\n    scheme: :rsa\n  )\n  # raises HighLevel::Webhooks::InvalidSignatureError if it doesn't verify\n  process(JSON.parse(body))\n  status 200\nrescue HighLevel::Webhooks::InvalidSignatureError\n  halt 401\nend\n```\n\n```ruby\n# Rails controller\ndef highlevel\n  HighLevel::Webhooks.verify(\n    payload: request.raw_post,\n    signature: request.headers[\"X-Wh-Signature\"],\n    public_key: Rails.application.credentials.highlevel_webhook_public_key\n  )\n  ProcessWebhookJob.perform_later(request.raw_post)\n  head :ok\nrescue HighLevel::Webhooks::InvalidSignatureError\n  head :unauthorized\nend\n```\n\nPass the **raw request body bytes** — re-serializing a parsed JSON object changes the canonical form and breaks verification.\n\n## Pagination\n\nThe HighLevel API has no uniform pagination convention, so nothing is auto-paginated. `HighLevel::Pagination` is opt-in.\n\n```ruby\n# A proc that routes pagination params wherever the endpoint wants them.\nfetch = -\u003e(**page) do\n  client.contacts.search_contacts_advanced(body: { locationId: \"loc-1\" }.merge(page))\nend\n\n# Each page (raw response):\nHighLevel::Pagination.each_page(fetch, cursor_field: :skip, items_field: \"contacts\") do |page|\n  puts page[\"contacts\"].size\nend\n\n# Each item, flattened across pages:\nHighLevel::Pagination.each_item(fetch, cursor_field: :skip, items_field: \"contacts\") do |contact|\n  puts contact[\"id\"]\nend\n\n# Without a block, you get an Enumerator:\nenum = HighLevel::Pagination.each_item(fetch, cursor_field: :skip, items_field: \"contacts\")\nenum.lazy.select { |c| c[\"type\"] == \"lead\" }.first(10)\n```\n\n`cursor_field` is the parameter the endpoint advances on (`:offset`, `:skip`, ...). `limit_field` defaults to `:limit`; `page_size` defaults to `100`.\n\n## Error handling\n\nEvery non-2xx response raises a typed exception carrying `#status`, `#response_body`, and `#request_id`.\n\n```ruby\nbegin\n  client.contacts.get_all_tasks(contact_id: \"missing\")\nrescue HighLevel::NotFoundError =\u003e e\n  e.status        # =\u003e 404\n  e.response_body # =\u003e parsed JSON body\n  e.request_id    # =\u003e the x-request-id header, if present\nend\n```\n\n| Exception | Trigger |\n|---|---|\n| `HighLevel::BadRequestError` | 400 |\n| `HighLevel::UnauthorizedError` | 401 |\n| `HighLevel::ForbiddenError` | 403 |\n| `HighLevel::NotFoundError` | 404 |\n| `HighLevel::UnprocessableEntityError` | 422 |\n| `HighLevel::RateLimitError` | 429 |\n| `HighLevel::ServerError` | 5xx |\n| `HighLevel::Error` | other non-2xx |\n| `HighLevel::ConfigurationError` | bad/missing credentials |\n| `HighLevel::NetworkError` | transport-level failure |\n\nAll inherit from `HighLevel::Error`, so `rescue HighLevel::Error` catches everything.\n\n## Instrumentation\n\nThe SDK emits no logs. Pass any object responding to `#instrument(name, payload, \u0026block)` — `ActiveSupport::Notifications` is the obvious one — as `instrumenter:` and subscribe to the `request.high_level` event.\n\n```ruby\nclient = HighLevel::Client.new(\n  private_integration_token: \"pit-xxxx\",\n  instrumenter: ActiveSupport::Notifications\n)\n\nActiveSupport::Notifications.subscribe(\"request.high_level\") do |*, payload|\n  Rails.logger.info(\"HighLevel #{payload[:method].upcase} #{payload[:url]} → #{payload[:status]}\")\nend\n```\n\nWith no `instrumenter` configured, the instrumentation middleware is a transparent pass-through.\n\n## Differences from the official TypeScript SDK\n\n- **Naming** — methods are snake_case; arguments are keyword arguments.\n- **No global state** — every collaborator is injected through `HighLevel::Configuration`; there is no global mutable config. Thread-safe by construction.\n- **Webhook verification raises** — `HighLevel::Webhooks.verify` returns `true` or raises `InvalidSignatureError`, rather than returning a boolean.\n- **Pagination is explicit** — `HighLevel::Pagination` is opt-in; resource methods never auto-paginate.\n- **Storage gems are optional** — `redis`/`activerecord`/`mongo` are lazy-required, not runtime dependencies.\n- **Generated code is committed** — `bundle add gohighlevel` gives you a working library; there is no install-time codegen.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the spec-sync, regeneration, and drift-check workflows.\n\n## License\n\nMIT — see [LICENSE.txt](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobzolkos%2Fgohighlevel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobzolkos%2Fgohighlevel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobzolkos%2Fgohighlevel/lists"}