Shell Python Node PHP C# Ruby

Authentication

# Curl supports HTTP basic authentication with the `-u` command
# To use the `-u` command, add a `:` onto the API key.
curl "https://api.payload.co/transactions" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE:
import payload
pl = payload.Session('secret_key_3bW9JMZtPVDOfFNzwRdfE')
require 'payload'
pl = Payload::Session.new('secret_key_3bW9JMZtPVDOfFNzwRdfE')
<?php
require_once('vendor/autoload.php');
use Payload\API as pl;
pl::$api_key = "secret_key_3bW9JMZtPVDOfFNzwRdfE";
?>
import payload from 'payload-api'
const pl = payload.Session('secret_key_3bW9JMZtPVDOfFNzwRdfE');
using Payload;
var pl = new Payload.Session("secret_key_3bW9JMZtPVDOfFNzwRdfE");

To authenticate with Payload, use the API secret key found in Settings > API Keys. The secret key is passed as the username field in an HTTP Basic Auth header.

Environments & Profiles

Production Request

curl https://api.payload.co \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE:
import payload
pl = payload.Session('secret_key_3bW9JMZtPVDOfFNzwRdfE')
require 'payload'
pl = Payload::Session.new('secret_key_3bW9JMZtPVDOfFNzwRdfE')
<?php
require_once('vendor/autoload.php');
use Payload\API as pl;
pl::$api_key = 'secret_key_3bW9JMZtPVDOfFNzwRdfE';
?>
import payload from 'payload-api'
const pl = payload.Session('secret_key_3bW9JMZtPVDOfFNzwRdfE');
using Payload;
var pl = new Payload.Session("secret_key_3bW9JMZtPVDOfFNzwRdfE");

Test Request

curl https://api.payload.co \
    -u test_secret_key_dwjVajaCQKO4RJuV:
import payload
pl = payload.Session('test_secret_key_3bW9JMZtPVDOfFNzwRdfE')
require 'payload'
pl = Payload::Session.new('test_secret_key_3bW9JMZtPVDOfFNzwRdfE')
<?php
require_once('vendor/autoload.php');
use Payload\API as pl;
pl::$api_url = 'test_secret_key_dwjVajaCQKO4RJuV';
?>
import payload from 'payload-api'
const pl = payload.Session('test_secret_key_3bW9JMZtPVDOfFNzwRdfE');
using Payload;
var pl = new Payload.Session("test_secret_key_3bW9JMZtPVDOfFNzwRdfE");

Every environment and profile you have access to within your dashboard will have a unique api key. To learn more about setting up test environments, see test environment.

Authenticating between a sandbox test environment and a production environment is based on the api key. You'll notice that the sandbox api keys will start with test_.