HTTP(S) Request

You can communicate with Midtrans API by sending HTTP(S) request. The request consists of Base URL and HTTP(S) Header. The Base URL specifies the resource to which the request is applied. The HTTP(S) Header carries the data type of the request, data type of the response, and the authentication information. Midtrans then sends a response back in JSON format.


The Base URLs are as given below.

  • Sandbox Environment:
  • Production Environment:



In the Sandbox Environment, the transactions will not trigger actual purchase. Midtrans service can be fully utilized in the Production Environment.

HTTP(S) Header

An HTTP Header is used in an HTTP request to provide information about the request. The HTTP Header for Midtrans API request carries the following information.

Content-Typeapplication/jsonIndicates data type of the request.
Acceptapplication/jsonIndicates the expected data type of the response.
AuthorizationBasic base64(server key , :)Contains the credentials to authenticate a user. Midtrans uses Basic AUTH for authentication. For more details, refer Authorization

Content-Type and Accept Header

The input and output parameters for Midtrans API are in JSON format.

To accept JSON input and output parameters, you need to add the following HTTP(S) Header.

  • Content-Type: application/json
  • Accept: application/json



Maximum allowed size of HTTP(S) request is 16KB. Please limit the size of your HTTP requests to this value to avoid request failures.