Create Your API Credentials
Once you have registered for a free Spreedly account you need to get an environment key and access secret which serve as your API credentials.
You will see a “New Environment” button which you should click to bring you to the environment form. Fill in “Test” as the name for this environment and submit the form. Your environment has now been created and assigned an environment key.
The environment key (in this example:
IXq0Ix8kLbbxY1WKptdZHR1m8qx) will be used as part of your API credentials. You can execute API calls across different environments by using the relevant environment’s key.
Now that you have your environment key, which identifies the environment you wish to execute against, you need an access secret which will authorize your API calls.
Access secrets are created at the organization level. In Spreedly, click on the “Organization” tab which will bring you to the organization settings page. Towards the bottom you will be able to add a new access secret:
Access secrets should be created on a per-application basis, and are named as such. Create an access secret for the “Test App” app and submit the form. An access secret will be generated for you and can now be used to authorize API calls for any environment in the organization.
Unlike environment keys, access secrets are just that, secret. They should never be posted publicly or over an insecure channel.
Authenticating to the API
The Spreedly API leverages standard HTTP Basic Authentication for API requests. To use it, simply pass the environment key for the environment you want to use as the username, and an access secret as the password. With
curl it looks something like this:
$ curl -u 'environment-key:access-secret' <options> <url>
Almost all code samples in the docs use a test environment key and access secret. Simply use your environment key and access secret instead to access your data.
Now that you have Spreedly API credentials, you can perform your first operation, such as adding a gateway to start transacting.