Skip to main content

Deploy Reactors with API Keys

An API key that can create or update Reactors can deploy code that runs against your tokens, so a leaked key would let anyone deploy that code from anywhere. Basis Theory accepts Reactor changes made with an API key only from addresses on the IP allowlist of the key's Application. Changes made in the Customer Portal are not affected.

This restriction is rolling out to tenants gradually. Until it reaches your tenant, these calls keep working as they do today. Set up the allowlist described below before then, so your deploys keep working when it does.

What Is Restricted​

Each of these calls requires the key's Application to have an IP allowlist that includes the address the request comes from.

Method and endpointPermission
POST /reactorsreactor:create
PUT /reactors/{id} and PATCH /reactors/{id}reactor:update
DELETE /reactors/{id}reactor:delete

The deprecated Reactor Formula write endpoints follow the same rule. The Basis Theory CLI, the Terraform provider, and the SDKs call these endpoints with an API key, so the rule applies to them too.

Reading Reactors and invoking them with /react and /react-async are not restricted.

When an API Key Is Accepted​

A request to one of these endpoints succeeds when all of the following are true:

  • The key belongs to a Management or Private Application.
  • The Application has an IP allowlist.
  • The request comes from an address on that allowlist, and Basis Theory can determine that address.

Session keys are always refused. Code running inside a Reactor or Proxy cannot create, update, or delete Reactors, whether it uses its execution role or an Application key. See Reactors and Proxies for why an Application used by Reactor code should not hold an allowlist of your servers.

When a Request Is Refused​

A refused request returns 403. Which 403 you see tells you what to fix.

The Application has no allowlist, or the caller cannot be checked against one. The response names the operation and ends with a link to this page:

Response
{
"title": "Forbidden",
"status": 403,
"detail": "API keys can only perform reactor:create when their application has an IP allowlist that is enforced for your tenant and includes the caller's IP address. Make this change in the Basis Theory portal, or use an application with an enforced IP allowlist."
}

The operation is reactor:create, reactor:update, or reactor:delete, matching the call. Make the change in the Customer Portal, or use a key from an Application set up as described in Deploy Reactors from Automation. This response also appears when Basis Theory cannot determine the source address, and when the caller is a Session key or code running in a Reactor or Proxy.

The Application has an allowlist, but not this address. The response names the address Basis Theory saw:

Response
{
"title": "Forbidden",
"status": 403,
"detail": "Requests from 198.51.100.24 are not allowed for this application."
}

Add the named address to the Application's allowlist. A change usually takes effect within a few seconds and can take up to 60 seconds. See IP Allowlist for the entry format and limits.

Deploy Reactors from Automation​

For occasional changes, make them in the Customer Portal. Nothing needs to be set up.

For automated deploys, create a dedicated Management Application and grant it only the permissions the deploy needs: reactor:create, reactor:update, and reactor:delete, plus reactor:read if you use Terraform, which reads Reactors on every plan and refresh. Give it an IP allowlist containing the outbound addresses of the machine that runs the deploy, set in the Customer Portal or with ip_allowlist on Create Application or Update Application. Don't reuse an Application whose key your servers or Reactor code use for other work, because its allowlist would then have to cover all of those callers. Never add Basis Theory's IP addresses to an allowlist.

With Terraform, set the provider's api_key to that Application's key and run terraform apply from the machine with the fixed address. If your configuration also manages the Application, note that an omitted ip_allowlist does not clear an allowlist added in the Customer Portal, as described in Update Application.

In CI, shared hosted runners usually send requests from large, changing address ranges that do not fit in an allowlist of 10 entries. Run Reactor deploys from a runner or network with fixed outbound addresses, such as a self-hosted runner, a runner with static egress, or a NAT gateway or egress proxy.

To check the setup, make one Reactor update from the pipeline after setting the allowlist. If an address is missing, the 403 names the address to add.