---
title: "Create an environment"
method: POST
path: "/environments"
tags: ["environments"]
---

# Create an environment

`POST /environments`

Create an environment in your organization. You will need to create one environment and access secret manually at app.spreedly.com for authentication. After that you can authenticate the API call using that environment key and an Organization Access Secret.

## Request body

- EnvironmentCreate
  - `environment` object
    - `name` string, required — The human readable name of the environment. There is a 100 character limit and it cannot contain the following characters: ``\ | ` # $ % { } ; " < >``
    - `callback_url` string — The url where Spreedly will attempt delivery of account updater transaction results. Transaction results are posted in JSON format. (default: null)
    - `allow_direct_api_method_creation` boolean — If the environment allows payment method creation from anywhere, or only from Spreedly Express or Iframe (default: true).
    - `au_enabled` boolean — If the environment should have cards sent to Account Updater or not (default: false).
    - `payment_method_management_enabled` boolean — If an environment is enabled to manage payment methods with Advanced Vaulting.
    - `iframe_enhanced_security_enabled` boolean — If the environment is enabled to pass enhanced security fields to iFrame init.

## Response `201`

Created

- EnvironmentResponse
  - `environment` EnvironmentProperties
    - `key` string — The key identifying the environment at Spreedly.
    - `signing_secret` string — The secret used to sign callbacks that are made back into your application.
    - `organization_key` string — The organization that the environment belongs to.
    - `callback_url` string — The url where Spreedly will attempt delivery of account updater transaction results. Transaction results are posted in JSON format.
    - `smart_routing_enabled` boolean — If the environment has smart routing enabled or not.
    - `allow_direct_api_payment_method_creation` boolean — If the environment allows payment method creation from anywhere, or only from Spreedly Express or Iframe.
    - `name` string — The human readable name of the environment.
    - `default_gateway_token` string — The default gateway to send transactions if smart routing is enabled.
    - `payment_method_management_enabled` boolean — If an environment is enabled to manage payment methods with Advanced Vaulting.
    - `au_enabled` boolean — If the environment has account updater enabled.
    - `retry` boolean — If the environment has retry enabled.
    - `iframe_enhanced_security_enabled` boolean — If the environment is enabled to pass enhanced security fields to iFrame init.

## Other responses

- `401` — Unauthorized
- `422` — Unprocessable entity

---

[API](https://skmtc.dev/spreedly/apis/spreedly-api-v1.md) · [All operations](https://skmtc.dev/spreedly/apis/spreedly-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/spreedly/spreedly-api-v1/revisions/72ba4e23e65c/schema)
