Skip to main content
Environments can also be managed in the KeyStone Dashboard under Settings > Environments - no code required.
Environments provide data isolation within a platform (e.g., development, staging, production). Each environment has its own settlements, webhooks, IP allowlists, and M2M credentials.

create

const env = await client.environments.create({
  name: "Staging",
  slug: "staging",
  auth0ClientId: "your-staging-m2m-client-id",
  defaultTimeoutSeconds: 3600,
});
FieldTypeRequiredDefaultDescription
namestringYes-Display name
slugstringYes-URL-friendly identifier (lowercase, hyphens)
auth0ClientIdstringYes-M2M client ID for this environment
webhookUrlstringNo-Default webhook URL
webhookSecretstringNo-Default webhook secret
defaultTimeoutSecondsnumberNo3600Default settlement timeout (60 to 604800)

list / get

const { items } = await client.environments.list();

const env = await client.environments.get("env-uuid");
console.log(`${env.name} (${env.slug}): active=${env.isActive}`);

EnvironmentRead

FieldTypeDescription
idstringEnvironment UUID
platformIdstringParent platform UUID
namestringDisplay name
slugstringURL-friendly identifier
auth0ClientIdstringM2M credential for this environment
webhookUrlstring | nullDefault webhook URL
apiVersionstring | nullPinned API version
defaultTimeoutSecondsnumberDefault settlement timeout
isActivebooleanWhether M2M auth is accepted
rateLimitRpmnumber | nullRate limit override (requests per minute)
createdAtstringCreation timestamp
updatedAtstringLast update timestamp

update

await client.environments.update("env-uuid", {
  defaultTimeoutSeconds: 7200,
  rateLimitRpm: 1000,
});
FieldTypeDescription
namestringDisplay name
webhookUrlstring | nullDefault webhook URL
webhookSecretstring | nullDefault webhook secret
defaultTimeoutSecondsnumberSettlement timeout
isActivebooleanEnable or disable
rateLimitRpmnumber | nullRate limit override

deactivate

Deactivate an environment. Preserves all data but blocks M2M authentication using this environment’s credentials.
const env = await client.environments.deactivate("env-uuid");
console.log(env.isActive); // false
To reactivate, use update with isActive: true.