Example Request

GET /v2/configuration HTTP/1.1
Host: api-sandbox.afterpay.com
Authorization: Basic MzI6YWJjZGVmZ2g=
curl "https://api-sandbox.afterpay.com/v2/configuration" \
  -H 'Authorization: Basic MzI6YWJjZGVmZ2g='
var request = require("request");

var options = {
  url: 'https://api-sandbox.afterpay.com/v2/configuration',
  headers: {
    Authorization: 'Basic MzI6YWJjZGVmZ2g='

request(options, function (error, response, body) {
  if (error) throw new Error(error);

require 'uri'
require 'net/http'

url = URI("https://api-sandbox.afterpay.com/v2/configuration")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic MzI6YWJjZGVmZ2g='

response = http.request(request)
puts response.read_body
import requests

url = "https://api-sandbox.afterpay.com/v2/configuration"

headers = {
    'Authorization': "Basic MzI6YWJjZGVmZ2g="

response = requests.request("GET", url, headers=headers)


The Afterpay Online API uses Basic HTTP Authentication, a simple authentication scheme built into the HTTP protocol, as specified by RFC 7617.

With the exception of Ping, all Online API endpoints require this form of authentication. Failure to correctly authenticate an API request will result in a "401 Unauthorized" response.

Consider the following example.

Merchant ID

Secret Key





In conventional HTTP terms, "Merchant ID" is the username and "Secret Key" is the password.

The credentials are joined by a colon character (without any spaces), then base64-encoded.

Plain Text

Base64 Encoded



The Authorization header can then be formed by including the word Basic, followed by a single space character, followed by the base64-encoded credential pair.

Final Header

Authorization: Basic MzI6YWJjZGVmZ2g=


Security Notice

Please note that the base64-encoding of the Authorization header is unrelated to security. All HTTP headers and bodies (for both requests and responses) between the Merchant and Afterpay are encrypted with TLS. The reason for base64-encoding is solely to comply with the RFC 7617 standard, which allows non-HTTP characters and multibyte strings to be used for Basic HTTP Authentication.