---
title: "Create a gateway"
method: POST
path: "/gateways.{format}"
tags: ["gateways"]
---

# Create a gateway

`POST /gateways.{format}`

Create (provision) a gateway to process card data in the authenticated environment. A test gateway is used to [test your integration](https://developer.spreedly.com/docs/testing/) to Spreedly and can only be used with [test payment methods](https://developer.spreedly.com/docs/test-data/). Production gateways process real card data and transactions. Production gateways are created using the credentials required for that gateway, meaning each call is slightly different depending on the gateway's API requirements.

## Request body

- Gateway
  - `gateway` object
    - `gateway_type` string, required — The type (short name) of the gateway. Use this value when provisioning a gateway. You can find the list of supported gateways and their respective gateway types [on this page](https://developer.spreedly.com/docs/supported-gateways)
    - `description` string — A description of the gateway. Useful to differentiate between multiple gateways of the same type provisioned within your system.
    - `merchant_profile_key` string — The token for an existing Merchant Profile in your environment. Useful to organize gateways in an environment with multiple merchants, or to associate merchant data with gateway transactions.
    - `sub_merchant_key` string — The token for an existing Sub-merchant in your environment. Useful for tagging the transactions through this gateway with the sub-merchant who transacts through the gateway.
    - `sandbox` boolean — **true** or **false**. Useful to test out a gateway's sandbox mode, this is recommended in situations where the gateway integration is difficult and where you don't want to execute real transactions.

## Response `201`

Created

- GatewayResponse
  - `gateway` GatewayProperties
    - `token` string — The token identifying the provisioned gateway at Spreedly
    - `name` string — The human readable name of the gateway
    - `gateway_type` string — The type (short name) of the gateway. Use this value when provisioning a gateway
    - `description` string — The description of the provisioned gateway
    - `merchant_profile_key` string — The token of the Merchant Profile associated with the provisioned gateway
    - `sub_merchant_key` string — The token of the Sub-merchant associated with the provisioned gateway
    - `state` string — The storage state of the gateway (retained, redacted, etc…)
    - `sandbox` boolean — If the gateway was created in sandbox mode or not
    - `redacted` boolean — If this gateway is redacted or not
    - `credentials` unknown[] — The non-sensitive credentials used for this gateway
      - unknown
    - `gateway_settings` object — The non-credential fields that can be specified at the gateway level, and included in all transactions
    - `characteristics` unknown[] — A list of operations (such as purchase, capture etc…) that the gateway supports
      - unknown
    - `payment_methods` unknown[] — A list of payment methods (such as credit_card, apple_pay, google_pay, etc…) that the gateway supports
      - unknown
    - `gateway_specific_fields` string[] — The list of gateway specific fields that can be specified in supported gateway transactions
    - `created_at` string — The time the gateway was created
    - `updated_at` string — The time the gateway was last updated

## Other responses

- `401` — Unauthorized
- `422` — Unprocessable Entity

---

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