Sparkforge Python and PHP SDKs for the v2 Public API

By Sparkforge Support Team ·Last reviewed May 3, 2026

The official Sparkforge Python and PHP SDKs wrap the v2 Public API and handle OAuth 2.0 token exchange, refresh, and webhook signature validation automatically. Drop them in and skip the auth plumbing.

The official Sparkforge Python and PHP SDKs wrap the entire v2 Public API and handle OAuth 2.0 token work for you. Drop them into your stack and skip the authentication plumbing.

What the SDKs cover

The sparkforge/api-client (PHP) and sparkforge-api-client (Python) libraries automate OAuth 2.0 token exchange, rotation, uninstall cleanup, and marketplace bulk-installs. Every public endpoint is exposed through type-safe helpers.

What you get

  • One-line OAuth 2.0 — exchange, store, and refresh tokens behind the scenes.
  • Database-agnostic session storage — adapters for Memory, MongoDB, Redis, MySQL, PostgreSQL, and custom backends.
  • Webhook helpers — validate signatures and process INSTALL / UNINSTALL events automatically.
  • Typed service methods — every public endpoint, with less boilerplate and fewer runtime errors.
  • Auto-generated — clients rebuild from the OpenAPI spec on every API release.

Supported OAuth 2.0 flows

  • Sub-account installs via the Marketplace Connect button
  • Bulk agency installs across all locations
  • Future auto-installs when new sub-accounts are created
  • Daily silent token refresh before expiry
  • Graceful uninstall cleanup

Token storage

Pluggable adapters keep tokens in whatever store you already run:

  • In-memory cache for local dev
  • MongoDB, Redis, MySQL, PostgreSQL
  • Custom class implementing the storage interface

Auto-generation

Both clients regenerate from the OpenAPI spec on every release. Update with a simple composer update or pip install --upgrade.

Resources

  • Sparkforge Python SDK and example project
  • Sparkforge PHP SDK and example project

Frequently Asked Questions

Do I still need to refresh tokens manually?
No. Once session storage is configured, the SDK refreshes tokens silently before they expire.
Can I store tokens somewhere other than MongoDB?
Yes. Built-in adapters cover MySQL, Redis, PostgreSQL, and in-memory. Extend the storage base class to add your own.
Does the SDK support Private Integration Tokens?
Yes. Pass <code>privateIntegrationToken</code> when you do not need OAuth flows.
How do I validate webhook signatures?
Use <code>client.webhooks.subscribe()</code> in Python or <code>getWebhookManager()->verifySignature()</code> in PHP.
Is the SDK compatible with v1 endpoints?
No. The SDK targets the v2 Public API only.

Was this article helpful?