Changelog

The latest APIMatic releases, with new features, improvements, and bug fixes across the APIMatic platform.

The latest APIMatic releases, with new features, improvements, and bug fixes across the APIMatic platform.

November 2026

Query Parameter Styles in Python v4 SDKs

Python v4 SDKs now follow the style and explode settings your OpenAPI specification declares for each query parameter. Arrays are sent in the exact shape your API expects.

Details

Previously, every array query parameter was sent with indexed keys (tags[0]=a&tags[1]=b), whatever the specification declared. Now each parameter is sent in its declared style:

styleexplodeArrayObject
formtrue (default)tags=a&tags=bcolor[R]=100&color[G]=200
formfalsetags=a,bcolor=R,100,G,200
spaceDelimitedfalseids=1%202color=R%20100%20G%20200
pipeDelimitedfalsecodes=x%7Cycolor=R%7C100%7CG%7C200
deepObjecttrueNot applicablefilter[status]=open

An exploded spaceDelimited or pipeDelimited array repeats its key, as form does. In a joined array, each item is encoded before the separator is written, so a comma inside an item is sent as %2C while the commas between items are not. Where the items are nullable, a None item keeps its place in a joined array as an empty value. An empty array is left out of the query.

An exploded object keeps its bracketed keys in every style, so an exploded form object isn't spread into separate keys (R=100&G=200). Brackets are shown as written here; in the request they are percent-encoded (filter%5Bstatus%5D=open).

Usage Example

Given this parameter in your specification:

- name: tags
  in: query
  style: form
  explode: false
  schema:
    type: array
    items:
      type: string

You call the method the same way as before:

orders = client.orders.find_orders(tags=["a", "b"])

The SDK now sends the query as ?tags=a,b.

This feature is available in the Python v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=python

For the full set of flags and options, see the CLI Reference.

A Redesigned API Playground with PKCE Sign-In

The API playground in your developer portal has a new layout and a safer sign-in. Build your portal with the latest APIMatic CLI to get it. There's nothing to change in apimatic.json.

New layout

Readers open the playground with the Try in Playground button on each endpoint. Example requests and responses appear as cards, and an endpoint with several examples gets a dropdown to switch between them.

Optional fields that aren't in the request yet show as greyed-out rows, and one click adds a field to the request. Click a field's name to read its description.

Code blocks in endpoint descriptions are now syntax highlighted. Long field paths and long unbroken strings stay inside their boxes, and a long example response no longer runs over the links to the previous and next pages.

Sign-in and credentials

  • OAuth 2.0 sign-in now uses PKCE. If someone intercepts the authorization code on its way back to the portal, they can't use it on its own.
  • The provider's response no longer shows up in the page address after a reader signs in.
  • Credentials and tokens are kept only until the reader closes the browser tab. Of the sign-in details, only the OAuth client ID is remembered between visits.
  • API keys and tokens are typed into password fields, and the cURL sample shows them as ********.

Request fixes

  • Path parameter values are now percent-encoded.
  • Form fields set to 0, false or an empty value are no longer dropped from the request body.
  • Cookie parameters are sent the way your API definition describes them.

For more on the playground, see Live API code playground.

Analytics and Custom Scripts in Developer Portals

You can now add Google Tag Manager and Google Analytics 4 to your developer portal, along with scripts of your own, such as a chat widget or a consent banner. You set them up in src/apimatic.json.

Google Tag Manager and Google Analytics 4

Add your container ID, your measurement ID, or both:

"portal": {
  "analytics": {
    "googleTagManager": { "containerId": "GTM-ABC123" },
    "googleAnalytics": { "measurementId": "G-ABC123" }
  }
}

The portal reports page views, searches, code and Markdown copies, SDK downloads, requests sent from the API playground, Context Plugin installs and missing pages. Each event goes to window.dataLayer for Tag Manager, and to GA4 directly when you've set a measurement ID. Page addresses are reported without their query string, apart from campaign and ad-click parameters and any you add to keepQueryParams.

If you use GA4, turn off Page changes based on browser history events in your stream's enhanced measurement settings. The portal already sends a page view for every page, so leaving it on counts each page twice. The CLI reminds you of this when you build or preview your portal.

To test a staging build against one of your container's environments, set googleTagManager.environment.

Consent

The portal doesn't ask readers for consent. Implementing consent is your responsibility, under the laws and regulations that apply to your portal. If you use a consent banner, add "googleConsentMode": { "default": "denied" }. The Google tags then set no cookies and mark their hits as denied until your banner passes on the reader's choice.

Custom scripts

List your scripts under portal.scripts. Each one is an https:// address or a file in src/static, and each needs a category:

"portal": {
  "scripts": [
    { "src": "static/js/consent.js", "category": "necessary" },
    { "src": "https://cdn.example.com/chat.js", "category": "functional" }
  ]
}

The category is necessary, functional, analytics or marketing. It decides which scripts --no-analytics leaves out, and nothing else: it doesn't hold a script back until the reader consents.

Scripts load on every page, in the order you list them, once the page is ready. That means a script can add things to the page, such as a link in the header. A script can also receive the portal's events through window.apimatic.analytics.subscribe().

Previews and staging builds

apimatic portal serve loads your tags and scripts the same way your live portal does, so your own visits show up in your reports. Add --no-analytics to keep them out. The Google tags and your analytics and marketing scripts are left out, and the scripts that remain get no events. The same flag works with apimatic portal generate for a staging build.

Other changes

  • portal.seo.googleSiteVerification adds Google's site verification tag to every page, so you can verify your portal in Search Console.
  • The API playground is marked so that session replay tools such as Hotjar, FullStory and Microsoft Clarity leave it out of their recordings.

For setup details, see Set Up Analytics and Add Custom Scripts. For every flag and option, see the CLI Reference.

SDK Hooks in TypeScript v4 SDKs

TypeScript v4 SDKs now support hooks: your own functions that run before each request is sent and after each response arrives. Use them to add headers, trace calls, or inspect and replace what the SDK sends and receives.

Details

ClientOptions.hooks sets hooks for every call the client makes, and RequestOptions.hooks sets hooks for one call. Each takes a HookOptions with two lists of functions:

  • beforeRequest hooks run after the credential is applied, just before the request is sent. A hook can set headers on the Request it's handed, or return a new Request to send instead.
  • afterResponse hooks run as soon as the response headers arrive, before the SDK decides whether to retry and before it decodes the body. A hook can read the response, or return a new Response for the SDK to use instead.

Each hook also gets a HookContext with the call's method, uri and options, plus the call's AbortSignal. Hooks can be sync or async.

The client's hooks run first, then the call's, so a call adds to the client's hooks rather than replacing them. Hooks run on every attempt of a retried call and on every page of a paginated call.

Usage Example

Set hooks for every call when you build the client:

import { PaymentsClient, type HookOptions } from "payments";

const hooks: HookOptions = {
  beforeRequest: [
    (request) => {
      request.headers.set("X-Trace-Id", crypto.randomUUID());
    },
  ],
  afterResponse: [
    (response, context) => {
      console.log(`${context.method} ${context.uri}: ${response.status}`);
    },
  ],
};

const client = new PaymentsClient({ hooks });

Add a hook to a single call through its request options:

const cutoff = await client.payments.settlementCutoff(
  { accountId: "acc_123", settlementDate: "2026-11-17" },
  {
    hooks: {
      beforeRequest: [
        (request) => {
          request.headers.set("X-Tenant-Id", "tenant_42");
        },
      ],
    },
  },
);

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.

Typed Additional Properties in Python v4 SDKs

Python v4 SDKs now follow what each schema's additionalProperties says about keys the schema does not declare. A model keeps them, validates them against a declared type, or refuses them, and every model reads its extras through one read-only additional_properties mapping.

Details

The schema saysAn extra key
additionalProperties absent, true or {}kept with any value, and sent back under the key it arrived with
additionalProperties: {schema}must match the schema; a wrong value refuses the whole object
additionalProperties: falserefused

Read every extra with model.additional_properties, typed by the model, or one extra with model["key"], which raises KeyError when it's absent. Set extras when you build a model, as keyword arguments beside the declared fields, or with model_validate for a key that isn't a Python name. Type checkers such as pyright and mypy report an extra keyword argument as an unknown parameter, so model_validate is the spelling that type-checks cleanly. A model is frozen, so assigning an extra afterwards raises ValidationError. On a model with typed extras, a write into model_extra or a model_copy(update=...) that adds a key raises TypeError, because neither would validate the value. Build a new model instead.

A wrong or refused key raises pydantic's ValidationError when you build the model, naming the key. In a response, it raises ResponseDecodeError, with that ValidationError as its __cause__. A model with typed extras also types them on its …Dict companion, through PEP 728's extra_items, so pyright checks the extras you pass as a plain dictionary. Support for extra_items hasn't reached mypy yet.

A property your specification names additional_properties is generated as additional_properties_value, so it doesn't clash with the accessor.

Usage Example

A schema whose additionalProperties is a model gives typed extras:

Metadata:
  type: object
  description: Arbitrary metadata attached to a payment.
  additionalProperties:
    $ref: "#/components/schemas/MetadataEntry"
  properties:
    source:
      type: string
MetadataEntry:
  type: object
  properties:
    label:
      type: string

Each extra is decoded into that model, and a value that doesn't fit it is refused:

from payments.models import Metadata, MetadataEntry

# Extras as keyword arguments, or through model_validate for a key that isn't a Python name.
metadata = Metadata(source="checkout", campaign=MetadataEntry(label="spring-sale"))
metadata = Metadata.model_validate({"source": "checkout", "campaign": {"label": "spring-sale"}})

metadata["campaign"].label  # "spring-sale": the extra is a MetadataEntry

for key, entry in metadata.additional_properties.items():
    print(key, entry.label)

Metadata.model_validate({"source": "checkout", "campaign": 5})  # ValidationError at ('campaign',)

This feature is available in the Python v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=python

For the full set of flags and options, see the CLI Reference.

Webhook Support in Python v4 SDKs

Python v4 SDKs now understand the webhooks declared in your OpenAPI specification. The SDK generates a typed event parser and, when the specification describes a signing scheme, a signature verifier, so consumers can verify and handle events with the same type safety they get when calling your API.

Details

Each webhook event becomes a typed class in the SDK's webhooks module, such as PaymentStatusUpdatedWebhookEvent, with the event's model as its payload. parse_webhook_event reads the event type your specification names, from the request body or a header, and returns the matching event. A match on the event's class gives you the payload already typed, and ending it with case _: assert_never(event) makes your type checker report an event you don't handle.

An event type added after the SDK was generated doesn't fail the delivery: it parses as UnknownWebhookEvent. Its type carries the type as sent, and its payload is an Unknown that keeps the body as it arrived, read with .root. A known event type whose body its model rejects is malformed, so it raises ValueError, as does JSON that doesn't parse, or a body with no event type. When the specification names no event type, parse_webhook_event returns the first payload model the body fits, or an Unknown when none does.

The signature verifier, such as PaymentsSignatureVerifier, takes a WebhookOptions, or the same keys as a dict:

  • secret: the shared signing secret, or a function given each delivery that returns it, so you can rotate the secret or pick one per tenant without rebuilding the verifier.
  • replay_tolerance: how many seconds a delivery's timestamp may differ from now, when the API sends a timestamp. Defaults to 300.0; None turns the replay check off.

A WebhookRequest carries the raw body bytes and the headers of one delivery. It takes the body as your framework buffered it, or as a binary stream, and the headers as a mapping or as name-value pairs. Pass the headers as pairs (request.headers.items()), so a header sent more than once keeps every value, and read the raw body before anything else reads the stream. The verifier and the parser take the same request, so both see the exact bytes that were signed.

Usage Example

Handle each incoming request in your webhook endpoint:

import os

from flask import Flask, request

from payments import WebhookRequest
from payments.webhooks import (
    PaymentsSignatureVerifier,
    PaymentStatusUpdatedWebhookEvent,
    UnknownWebhookEvent,
    parse_webhook_event,
)

app = Flask(__name__)
verifier = PaymentsSignatureVerifier({"secret": os.environ["PAYMENTS_WEBHOOK_SECRET"]})


@app.post("/webhooks/payments")
def payments_webhook():
    webhook_request = WebhookRequest(body=request.get_data(), headers=request.headers.items())

    if not verifier.verify(webhook_request):
        return "", 401

    try:
        event = parse_webhook_event(webhook_request)
    except ValueError:
        return "", 400

    match event:
        case PaymentStatusUpdatedWebhookEvent(payload=updated):
            print(f"Payment status {updated.payment_status_id} updated")
        case UnknownWebhookEvent(type=event_type, payload=unknown):
            # An event type this SDK doesn't model yet: acknowledge it.
            print(f"Unhandled event {event_type}: {unknown.root}")

    return "", 200

Parsing only decodes the event, so always call verify first when your API signs its webhooks.

This feature is available in the Python v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=python

For the full set of flags and options, see the CLI Reference.

Query Parameter Styles in TypeScript v4 SDKs

TypeScript v4 SDKs now follow the style and explode settings your OpenAPI specification declares for each query parameter. Arrays and objects are sent in the exact shape your API expects.

Details

Previously, every array query parameter repeated its key (tags=a&tags=b) and every object was sent with bracketed keys (color[R]=100), whatever the specification declared. Now each parameter is sent in its declared style:

styleexplodeArrayObject
formtrue (default)tags=a&tags=bR=100&G=200
formfalsetags=a,bcolor=R,100,G,200
spaceDelimitedfalseids=1%202color=R%20100%20G%20200
pipeDelimitedfalsecodes=x%7Cycolor=R%7C100%7CG%7C200
deepObjecttrueNot applicablefilter[status]=open

Under form with explode: false, the commas between items are sent unencoded, while a comma inside an item is still encoded as %2C. An empty array or object is left out of the query entirely, whatever its style.

Note This changes requests for some existing specifications. An object query parameter with no style uses OpenAPI's default, form with explode: true, so its properties are now sent as keys of their own (status=open) instead of bracketed keys (where[status]=open). Arrays under the default style are unchanged.

Usage Example

Given this parameter in your specification:

- name: tags
  in: query
  style: form
  explode: false
  schema:
    type: array
    items:
      type: string

You call the method the same way as before:

const orders = await client.orders.find({ tags: ["a", "b"] });

The SDK now sends the query as ?tags=a,b.

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.

Webhook Support in TypeScript v4 SDKs

TypeScript v4 SDKs now understand the webhooks declared in your OpenAPI specification. The SDK generates a typed event parser and, when the specification describes a signing scheme, a signature verifier, so consumers can verify and handle events with the same type safety they get when calling your API.

Details

Each webhook event's payload becomes a typed model. The parser reads the discriminator your specification names, from the request body or a header, and returns an event with a type and a payload. One is… method per event, such as isPaymentStatusUpdated(), narrows payload to that event's model. A delivery whose type and payload match no listed event still parses, with every is… method returning false, so you can log it instead of dropping it.

When the specification describes how events are signed, the SDK also generates a signature verifier configured through WebhookOptions: the shared secret, as a string or a function called on every verify so you can rotate it without rebuilding the verifier, and a replayTolerance in seconds that defaults to the window the specification sets. Set replayTolerance: false to turn the replay check off. Verification runs on WebCrypto, so it works in Node.js and edge runtimes alike.

A WebhookRequest carries the raw body bytes and the headers of one delivery. Build it with WebhookRequest.fromRequest() from a Fetch Request, WebhookRequest.fromStream() from a Node.js stream, or WebhookRequest.fromBytes() from a body you already read. The verifier and the parser take the same request, so both see the exact bytes that were signed.

Usage Example

Verify each incoming request, then parse it and handle the event in your webhook endpoint:

import { PaymentsSignatureVerifier, parsePaymentsWebhookEvent, WebhookRequest } from "payments";

const verifier = new PaymentsSignatureVerifier({
  secret: process.env.PAYMENTS_WEBHOOK_SECRET,
});

app.post("/webhooks/payments", async (req, res) => {
  const webhook = await WebhookRequest.fromStream(req, req.headers);

  if (!(await verifier.verify(webhook))) {
    res.sendStatus(401);
    return;
  }

  const event = parsePaymentsWebhookEvent(webhook);
  if (event.isPaymentStatusUpdated()) {
    console.log(`Payment status changed: ${event.payload.status}`);
  } else if (event.isPaymentStatusCreated()) {
    console.log(`Payment status created: ${event.payload.paymentStatusId}`);
  } else {
    console.warn(`Unhandled event: ${event.type}`);
  }

  res.sendStatus(200);
});

Parsing only decodes the event, so always call verify first when your API signs its webhooks.

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.

SDK Hooks in Python v4 SDKs

Python v4 SDKs now support hooks: your own code that runs before each request is sent and after each response arrives. Use them to add headers, trace calls, or inspect and replace what the SDK sends and receives.

Details

A hook has two events:

  • before_request gets the request after it is built and authenticated, and returns the request to send. A request is frozen, so return it unchanged or a dataclasses.replace of it.
  • after_response gets the response before the SDK decides whether to retry, and returns the response the call acts on: the same one, or your own object implementing HttpResponse.

Each also gets a HookContext with the call's method, url and request_options.

The hooks parameter takes one of two spellings, on the client and in request_options alike: a list of SdkHook subclasses, or plain functions in a dict keyed on_request and on_response. Use one spelling per place, not a mix. A hook that keeps state between a request and its response is a class.

The client's hooks run first, then the call's, so a call adds to the client's hooks rather than replacing them. Hooks run on every attempt, retries included, so a hook must be safe to run more than once. On the token requests that OAuth schemes make, only the client's hooks run, not the call's. A hook that raises ends the call with its own exception, except an SdkConnectionError from before_request, which is retried like a failed send. On the async client, the same shape is AsyncSdkHook, whose methods are async def and take an AsyncHookContext, and whose after_response gets and returns an AsyncHttpResponse.

A subclass of SdkHook overrides only the method it needs; the other passes its value through. A hook that reads the response body must return a response that still carries it, and a hook that returns a different response owns the one it was handed.

Usage Example

Subclass SdkHook, or pass plain functions, when you build the client:

from dataclasses import replace
from uuid import uuid4

from payments import PaymentsClient
from payments.core import HookContext, HttpRequest, HttpResponse, SdkHook, safe_url


class Tracing(SdkHook):
    def before_request(self, request: HttpRequest, context: HookContext) -> HttpRequest:
        return replace(request, headers={**request.headers, "x-trace-id": uuid4().hex})

    def after_response(self, response: HttpResponse, context: HookContext) -> HttpResponse:
        # safe_url drops the query, so a credential sent there is never printed.
        print(f"{context.method} {safe_url(context.url)} -> {response.status_code}")
        return response


client = PaymentsClient(bearer_auth="YOUR_ACCESS_TOKEN", hooks=[Tracing()])


# Or plain functions, with nothing to subclass:
def add_tenant(request: HttpRequest, context: HookContext) -> HttpRequest:
    return replace(request, headers={**request.headers, "x-tenant-id": "tenant_42"})


client = PaymentsClient(bearer_auth="YOUR_ACCESS_TOKEN", hooks={"on_request": [add_tenant]})

Add a hook to a single call through its request options:

payment = client.payments.get_payment("pay_123", request_options={"hooks": {"on_request": [add_tenant]}})

To reuse the same hooks across several calls, hold them in a RequestOptions:

from payments.core import RequestOptions

traced = RequestOptions(hooks=[Tracing()])
payment = client.payments.get_payment("pay_123", request_options=traced)

This feature is available in the Python v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=python

For the full set of flags and options, see the CLI Reference.

Adding Schema Constraint Validation in TypeScript v4 SDKs

Generated TypeScript v4 SDKs now express your OpenAPI schema constraints on the generated model schemas, so you can validate a request before sending it with one call. The SDK's own operations keep sending and accepting values as before, so validation is yours to run when you want it.

Details

Schema constraints on the model's schema

Constraints defined in your OpenAPI schemas, such as string lengths, patterns, numeric bounds, array rules, object property counts, and string formats, are now carried onto the generated model's schema. A model whose specification declares constraints exports a schema that enforces them, under the model's plain name from the package root. A model that nests a constrained one carries the constraints too, and reports a failing field under its full path. oneOf and anyOf unions carry them as well: the union's schema validates each arm against that arm's own constraints.

The constraints are opt-in: the SDK carries them for you, and you decide when to run validation. An operation still sends a request as you built it and accepts a response as the service returned it, so a service that is ahead of its specification is never refused, and you are never blocked from sending a value the service would take.

Validating a request

Every schema now has a validate method. Pass it a request body, a model, or any other value typed by that schema, and it runs the schema's rules without converting the value and without throwing. It returns { success: true } or { success: false, message }, and the message lists every failing field with its reason, so you can branch on the outcome before the request leaves. A check never runs on an omitted optional field, and a missing required field is reported as the same structural failure it has always been.

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.

One SdkError Family in Python v4 SDKs

Python v4 SDKs now raise one exception family. Everything the SDK raises for a call derives from SdkError, so one except SdkError catches every failure, and you catch a member of the family when you want less.

Details

Every member names the call it belongs to as method and url. The URL has its query removed, so a parameter value or a credential sent in the query never reaches a message, a log line or a traceback. No message carries a response body. The exception that caused the failure, from the HTTP library or the decoder, is on __cause__.

ExceptionRaised forExtra attributes
ApiError[E]an error status, with the body decoded into the operation's error typeerror, status_code, headers
ResponseDecodeErrora body that does not match its declared typestatus_code, headers
SdkConnectionErrora request that could not be sent, or a body that could not be read
SdkTimeoutErroran SdkConnectionError that timed outtimeout
AuthSchemeErrora credential that could not be appliedscheme_failures

ApiError and ResponseDecodeError are siblings, so except ApiError never catches a body that failed to decode. The raw variant (.with_raw_response) returns an error status as a Failure instead of raising ApiError, and the rest of the family raises in both modes. Your own cancellation, such as KeyboardInterrupt or asyncio.CancelledError, is never wrapped, and a value the SDK refuses before sending stays a ValueError.

Usage Example

Catch the members you can handle, a leaf before its parent, then the root for anything else. ApiError.error is the operation's documented error body for that status, or a RawError for a status the specification doesn't document, so narrow it with match:

from payments import PaymentsClient, models
from payments.core import (
    ApiError,
    RawError,
    ResponseDecodeError,
    SdkConnectionError,
    SdkError,
    SdkTimeoutError,
)

client = PaymentsClient(bearer_auth="YOUR_ACCESS_TOKEN")

try:
    payment = client.payments.get_payment("pay_123")
except ApiError as error:
    # An error status: .error is the documented body for that status.
    match error.error:
        case models.PaymentError(message=message):
            print(f"{error.status_code}: {message}")
        case RawError() as raw:
            # An undocumented status: the raw body.
            print(f"{error.status_code}: {raw.text()}")
except ResponseDecodeError as error:
    # A body its declared type rejected.
    print(f"{error.status_code}: undecodable body ({type(error.__cause__).__name__})")
except SdkTimeoutError as error:
    # The leaf, so before its parent.
    print(f"{error.method} {error.url} timed out after {error.timeout} s")
except SdkConnectionError as error:
    print(f"{error.method} {error.url} could not connect: {error.__cause__!r}")
except SdkError as error:
    # Anything else the SDK raises for a call.
    print(error)

Changes to existing code

  • A connection failure that is still failing after every retry raises SdkConnectionError or SdkTimeoutError instead of the httpx2 exception.
  • A token request that fails raises AuthSchemeError instead of an ApiError carrying OAuthProviderError. OAuthProviderError and OAuthError are removed.
  • ResponseDecodeError replaces pydantic's ValidationError for a body its declared type rejects. It isn't a ValueError, so except ValueError no longer catches it.
  • In an OR auth requirement, a member that fails no longer ends the call: the next configured member is tried, and AuthSchemeError is raised only if every member fails.
  • A custom transport raises SdkConnectionError, or SdkTimeoutError for a timeout, in place of the removed TransportError, naming the call as method=request.method, url=safe_url(request.url). Any other exception it raises isn't retried. A custom HttpResponse must also expose method.

This feature is available in the Python v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=python

For the full set of flags and options, see the CLI Reference.

Preserving Additional Properties in TypeScript v4 SDKs

TypeScript v4 SDKs now keep the fields your specification does not name. Every open object model carries an optional additionalProperties record, so an extra field in a response has a typed place to be read, and you can send fields of your own that the specification does not declare.

Details

Every open object model gets one optional field, additionalProperties?: Record<string, T>. T is JsonValue, exported from the package root, when the specification gives no value schema, and the declared type otherwise. A schema that sets additionalProperties: false gets no field, and an unknown key on it still passes through, so the SDK never rejects a payload for a key it does not know.

The field is present only when the wire carried an extra, and its keys are wire names. Every value is validated against T in both directions, and what you put in the record is sent beside the declared fields.

The result is forward compatibility. When the API adds a field before you regenerate the SDK, it arrives in additionalProperties instead of being dropped, so you can read it right away and switch to the typed property once you regenerate. The same record lets you send a field the API accepts but the specification does not declare yet.

Usage Example

An open schema gives a record of JsonValue. An absent additionalProperties means the same as true.

Card:
  type: object
  description: A card payment method.
  additionalProperties: true
  required: [last4, brand]
  properties:
    last4:
      description: Last four digits of the card number.
      type: string
    brand:
      description: Card network, for example `visa`.
      type: string
/** A card payment method. */
export type Card = {
  /** Last four digits of the card number. */
  last4: string;
  /** Card network, for example `visa`. */
  brand: string;
  /** Properties the service sent or accepts beyond those declared. */
  additionalProperties?: Record<string, JsonValue>;
};

A schema whose additionalProperties is a model gives a record of that model, and each extra is decoded and encoded through the model's schema. The keyword's description becomes the field's doc comment.

Metadata:
  type: object
  description: Arbitrary metadata attached to a payment.
  additionalProperties:
    description: Further nested entries, keyed by name.
    $ref: "#/components/schemas/MetadataNested"
  properties:
    source:
      description: What produced the payment.
      type: string
    nested:
      $ref: "#/components/schemas/MetadataNested"
/** Arbitrary metadata attached to a payment. */
export type Metadata = {
  /** What produced the payment. */
  source?: string;
  /** A nested metadata entry. */
  nested?: MetadataNested;
  /** Further nested entries, keyed by name. */
  additionalProperties?: Record<string, MetadataNested>;
};

Read an extra with card.additionalProperties?.issuerCountry, and send one by putting it in the record.

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.

Customize v4 SDKs and Keep Your Changes When You Regenerate

You can now change any file in a generated C#, Python or TypeScript SDK, or add files of your own, and keep those changes every time you regenerate it. The APIMatic CLI merges each new generation into your version of the SDK, file by file, with git's three-way merge.

Start with --git-init

apimatic sdk generate --language=typescript --git-init

--git-init makes the SDK directory a git repository of its own, where the CLI keeps a snapshot of each generation. It needs git 2.38 or later.

Customize, then regenerate

Edit generated files, add your own, or add dependencies. Then run the same command, without --git-init, whenever your API definition changes. The CLI lists the files it merged with your changes and the ones it kept as yours.

Conflicts are listed before anything is written

When your changes and the generator's overlap, the CLI lists the files and asks what to do: resolve them yourself, use the generator's changes, use yours, or cancel. --force uses the generator's changes without asking, for CI.

Shared with your team

A pre-push hook sends the snapshots along with your branch, so a teammate's clone merges against the same generation.

This replaces the change-tracking flow of APIMatic CLI v1 (--track-changes and sdk save-changes). sdk generate no longer takes --zip or --api-version, and neither sdk generate nor sdk publish takes --codegen-version, because v4 is the only code generator.

For the full guide, see Customize SDKs. For the full set of flags and options, see the CLI Reference.

October 2026

OpenAPI Rules That Break Import or Code Generation Now Report Blocking

We've raised 26 OpenAPI 3.x rules to Blocking. Each one flags a problem that is certain to make APIMatic's import or code generation fail. Previously, these rules reported Error or Warning, which made those problems look less serious than they are. We also turned one rule on by default, turned one off, and added one new rule.

Behavior change

Three of these rules used to report a Warning, which didn't fail validation. They now report Blocking, so a definition that passed validation with warnings can now fail. A Blocking message also sets the validation score to 0. If you validate in CI, for example with the APIMatic OpenAPI Linter GitHub App, check whether your definitions trigger any of the rules below.

What changed

These rules now report Blocking:

RuleWas
OPENAPI3APIMATIC_L108 required-server-urlError
OPENAPI3APIMATIC_L693 at-least-one-item-in-schema-enum-listError
OPENAPI3APIMATIC_L699 non-primitive-any-of-schemas-in-polymorphismError
OPENAPI3APIMATIC_L700 non-primitive-one-of-schemas-in-polymorphismError
OPENAPI3CODEGEN_L099–L102, L138, L174, L205–L207, L585, L624, L625: names that exceed the maximum allowed lengthError
OPENAPI3STANDARDS_L150 at-least-one-item-in-schema-enum-listWarning
OPENAPI3STANDARDS_L270 use-registered-http-security-scheme-valueWarning
OPENAPI3STANDARDS_V025 required-server-urlError
OPENAPI3STANDARDS_V036 pre-defined-path-parameter-for-path-url-template-expressionError
OPENAPI3STANDARDS_V216 valid-callback-url-expressionError
OPENAPI3STANDARDS_V440 required-oauth2-flow-authorization-urlError
OPENAPI3STANDARDS_V441 required-oauth2-flow-token-urlError
OPENAPI3STANDARDS_V465 pre-defined-operation-parameters-for-expression-request-parameter-sourceError
OPENAPI3SYNTAX_V080 valid-callback-key-expressionWarning

The following rules also changed:

  • OPENAPI3APIMATIC_L672 no-binary-schema-for-operation-parameter is now on by default and reports Blocking. It flags a binary or file schema used for an operation parameter. Previously, it was off by default.
  • OPENAPI3APIMATIC_L950 supported-vendor-extension is now off by default.
  • OPENAPI3APIMATIC_L704 non-primitive-not-schema-in-polymorphism is new and reports Blocking. It covers the not keyword, the same way L699 and L700 cover anyOf and oneOf.

What you should do

Validate your OpenAPI definition and fix any Blocking messages before you generate SDKs or portals from it. To see every rule with its current severity, see the OpenAPI rulesets.

Dropping Vulnerable PHP Versions' Requirement From PHP SDKs

Generated PHP SDKs now declare a php requirement in composer.json that Composer won't satisfy on a PHP 8.2, 8.3, 8.4 or 8.5 build that's missing the October 21, 2026 security fixes. Projects on a patched runtime, and projects on PHP 7.2 to 8.1, aren't affected.

Details

Until now a generated PHP SDK declared:

"php": "^7.2 || ^8.0"

which let Composer install the SDK on any 8.x build, patched or not. The generated SDK now declares:

"php": ">=7.2 <8.2 || ~8.2.35 || ~8.3.36 || ~8.4.27 || ^8.5.12"

Composer checks this against the runtime on every composer install, composer require and composer update. An application already running an older SDK version keeps working, but it won't pick up a new SDK release until its PHP build satisfies the requirement.

What's allowed and what's rejected

PHP branchAllowed buildsChange from before
7.2 to 8.1AllNone
8.28.2.35 and later8.2.0 to 8.2.34 are rejected
8.38.3.36 and later8.3.0 to 8.3.35 are rejected
8.48.4.27 and later8.4.0 to 8.4.26 are rejected
8.58.5.12 and later8.5.0 to 8.5.11 are rejected
9.0NoneNone. PHP 9 was already excluded by ^8.0.

Why these builds are no longer supported

On October 21, 2026 the PHP project published a security advisory for two critical vulnerabilities, CVE-2026-109618 and CVE-2026-109619, together known as PHP2Shell. Both allow unauthenticated remote code execution against a PHP web server, both are rated CVSS 9.2, and exploitation has been observed in the wild. The flaws are in the PHP interpreter itself, not in the SDK or in any APIMatic library. The advisory states that updating PHP is the only complete fix and that no configuration change mitigates the flaws.

The fixes shipped in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Every earlier build on those four branches carries the flaws, so the SDK no longer accepts them. That stops a vulnerable deployment from quietly taking on a new SDK release, and gives its operator a clear signal to update PHP first.

PHP 7.2 to 8.1 remain accepted unchanged. Those branches no longer receive upstream updates, so the PHP project shipped no fixed release for them and there's no version number that separates a fixed build from a vulnerable one. Rejecting them outright would only break those deployments without making them any safer.

Adding Support for Pagination in TypeScript v4 SDKs

TypeScript v4 SDKs now support pagination, covering the four widely used strategies: Offset, Page, Cursor and Link based pagination. A paginated operation returns a Pageable that you loop over with for await.

Details

Mark an operation with the pagination OpenAPI extension, and its method returns a Pageable in place of the usual ApiPromise. You don't await it. Nothing is sent until a for await loop starts, and each new loop starts again from the first page. The paging fields in your request, such as page, offset, cursor and limit, set the first page only. From there, the SDK moves forward and decides when to stop:

  • Offset: moves the offset forward by the number of items received. Stops at the total item count, at an empty or short page, or when the response says there are no more.
  • Page: moves to the next page number. Stops at the total page count, at an empty or short page, or when the response says there are no more.
  • Cursor: sends the cursor from the last response. Stops when no new cursor comes back.
  • Link: follows the next link from the response body or headers. Stops when there is no new link.

Each page is a normal request, so the call's options apply to every page. Pass a signal to stop a long walk from outside the loop, or just break once you have enough.

Errors come out of the loop, not the call, so put the try around the loop. An error status throws the operation's ApiError. For safety, the SDK only follows a next link that points to the API's own host, so your credentials never go anywhere else. Any other link throws a PaginationError. If you'd rather not catch error statuses, .asApiResult().pages() gives you one result per page, and the failed page is the last one.

Usage Example

Loop over the items across every page, or go page by page when you need the page itself:

import { PaymentsClient, PaymentsError } from "payments";

const client = new PaymentsClient();

try {
  // Every payment across every page; pages are fetched as you iterate.
  for await (const payment of client.payments.list({ limit: 50 })) {
    console.log(payment.id);
  }

  // One page at a time.
  for await (const page of client.payments.list({ limit: 50 }).pages()) {
    console.log(`Fetched ${page.data.length} payments in this page`);
  }
} catch (err) {
  if (err instanceof PaymentsError) {
    console.error(`${err.kind}: ${err.message}`);
  } else {
    throw err;
  }
}

Use the result form when you would rather check each page than catch an error status:

for await (const result of client.payments.list({ limit: 50 }).asApiResult().pages()) {
  if (!result.ok) {
    console.error("A page failed with status", result.status);
    break;
  }
  console.log(`Fetched ${result.value.data.length} payments in this page`);
}

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.

Server-Sent Event Streaming in TypeScript v4 SDKs

TypeScript v4 SDKs now stream server-sent events. An operation whose success response is text/event-stream resolves to an EventStream<T> typed over the event's data schema, and you read it with for await.

Details

The call resolves as soon as the response headers arrive, and events are read from the connection only as your loop asks for them. Each iteration yields one event's data, already decoded: a string, a model, an array, or a discriminated union you narrow on its kind. The stream ends cleanly on the sentinel named by the x-sse-sentinel extension, which is consumed and never yielded, or when the server closes the connection.

Draining the loop releases the connection, and so does leaving it early with break, return or a throw. A stream you decide not to read is released with await stream.close(), or with await using where your runtime supports it, and aborting the signal you passed stops it from elsewhere.

The loop raises the same error family as the call itself: a DecodeError for an event whose data does not fit the schema, a ConnectionError when the connection drops, and a TimeoutError when the server stays silent for longer than the eventStream.idleTimeout client option, which defaults to 60 seconds. An error status rejects the call with ApiError before any event is read, and .asApiResult() gives you the opening status and headers of the stream.

Usage Example

Iterate the stream, and stop as soon as you have what you need:

import { PaymentsClient, PaymentsError } from "payments";

const client = new PaymentsClient({ eventStream: { idleTimeout: 30_000 } });

try {
  const updates = await client.payments.streamUpdates({ paymentId: "pay_123" });

  // Each event's data arrives as a typed model; breaking out releases the connection.
  for await (const update of updates) {
    console.log(update.status);
    if (update.settledAt) break;
  }
} catch (err) {
  if (err instanceof PaymentsError) {
    console.error(`${err.kind}: ${err.message}`);
  } else {
    throw err;
  }
}

Put the try around the loop, not only the call, because the call settles as soon as the headers arrive.

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.

Adding Support for Pagination in Python v4 SDKs

Python v4 SDKs now support pagination, covering the four widely used strategies: Offset, Page, Cursor and Link based pagination. A paginated operation returns a Paginator[Page, Item] on the synchronous client and an AsyncPaginator on the asynchronous one.

Details

The SDK detects paginated operations from the pagination OpenAPI extension and generates the walk for each strategy the operation declares, selecting request and response fields with the JSON Pointers in your extension configuration. Iterate the paginator to receive items across every page, or call iter_pages() to work with one page at a time.

The paginator is lazy. Building one sends nothing, the first request goes out when iteration starts, a break ends the walk with no further request, and each new iteration starts again from the first page. The arguments you pass set the first request only, and the SDK moves through the pages the way the API defines them. Every page is an ordinary request, so authentication, retries and request_options apply to each one.

A page that fails raises ApiError from the loop, after every item before it, so wrap the loop rather than the call. A link walk refuses a next link to a different origin and raises ValueError.

Usage Example

Iterate the items across every page, or go page by page when you need the page itself:

from payments import PaymentsClient
from payments.core import ApiError

client = PaymentsClient(bearer_auth="YOUR_ACCESS_TOKEN")

try:
    # Every payment across every page; pages are fetched as you iterate.
    for payment in client.payments.list_payments(limit=50):
        print(payment.id)

    # One page at a time.
    for page in client.payments.list_payments(limit=50).iter_pages():
        print(f"Fetched {len(page.data)} payments in this page")
except ApiError as e:
    print("A page failed with status", e.status_code)

On the async client the call is not awaited. It returns an AsyncPaginator that you iterate with async for:

async for payment in async_client.payments.list_payments(limit=50):
    print(payment.id)

This feature is available in the Python v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=python

For the full set of flags and options, see the APIMatic CLI documentation.

HTTP Logging in Python v4 SDKs

Python v4 SDKs now log HTTP requests and responses through Python's standard logging module. Nothing is printed until you turn the SDK's logger on, the same way you would for any library, or set one environment variable.

Details

The SDK writes under a logger named after its package and configures nothing itself: no handler, no level, and never the root logger. At INFO it writes one line as each request is sent and one when its response arrives, with the status and duration. WARNING covers responses outside 2xx and each retry, and ERROR a call that ends in an exception. For a run you cannot edit, an environment variable named after the package, such as PAYMENTS_LOG=info or debug, sets the level and adds a stderr handler when none is listening.

The logging_options keyword on the client, a dict or a LoggingOptions, turns on the DEBUG dumps of the request headers, the request body and the response headers. Header, query and form values print REDACTED unless they are known to be safe, so Authorization, cookies and API keys never reach the log, and a response body is never logged.

The per-call request_options accept a log_level floor that quietens one call. It never turns on a record the client's options leave off.

Usage Example

Raise the SDK's logger, choose the dumps on the client, and quieten a single call:

import logging

from payments import PaymentsClient

logging.basicConfig()
logging.getLogger("payments").setLevel(logging.DEBUG)

client = PaymentsClient(
    bearer_auth="YOUR_ACCESS_TOKEN",
    logging_options={"log_request_headers": True, "log_response_headers": True},
)

# The request and response lines, then both header dumps with Authorization masked.
client.payments.get_payment("pay_123")

# Nothing below WARNING is written for this call.
client.payments.get_payment("pay_456", request_options={"log_level": logging.WARNING})

log_request_body prints a JSON body as sent, so turn it on only where that content may be logged.

This feature is available in the Python v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=python

For the full set of flags and options, see the APIMatic CLI documentation.

HTTP Logging in TypeScript v4 SDKs

TypeScript v4 SDKs now log HTTP requests, responses and retries. Logging is off by default and is switched on through the logging client option, or from the environment without a code change.

Details

The logger writes the request line, the response line with its status and duration, a line before each retry, and a line for a call that ends without a response. Request headers, response headers and the request body are off by default and switched on with logRequestHeaders, logResponseHeaders and logRequestBody. Lines go to console unless you pass your own logger, which can be any object with error, warn, info and debug methods.

Query values and headers are redacted by allow-list, so credentials, cookies and API keys are masked. redactedKeys, redactedHeaders and unmaskHeaders adjust what is masked. A JSON request body is logged as it is, so leave logRequestBody off on endpoints that carry personal or payment data.

When the code sets neither a logger nor a level, the client reads an environment variable named after the client class in upper snake case, such as PAYMENTS_CLIENT_LOG for PaymentsClient. Set it to error, warn, info or debug to turn logging on. A call's second argument can set the level for that call alone.

Usage Example

Send the SDK's lines to your application's logger, and turn on full detail for one call:

import { PaymentsClient } from "payments";

const client = new PaymentsClient({
  logging: {
    logger: appLogger, // any object with error, warn, info and debug methods
    level: "info",
    logRequestHeaders: true,
    logResponseHeaders: true,
  },
});

// This call alone logs at debug, request body included.
await client.payments.get({ paymentId: "pay_123" }, { logging: { level: "debug" } });

To switch logging on in a deployed application without a code change, run it with PAYMENTS_CLIENT_LOG=info.

This feature is available in the TypeScript v4 SDK. Generate it with version 2.x of the APIMatic CLI:

apimatic sdk generate --language=typescript

For the full set of flags and options, see the APIMatic CLI documentation.