Authentication

{warning} This authentication API is likely to change in this Beta period, please be aware of this when programming your API. It is most likely that we will require a hashed version of the secret and public keys in the future.

Making Requests

Base URLs

https://api.devsmartgift.co.uk (development)

https://api.smart-gift.co.uk (production)

Only requests made using HTTPS will be accepted.

Authentication

Smart Gift uses API Keys to authenticate requests. You can view and edit your API Keys in the developer section of your Dashboard. These API keys must be kept secret and safe, only those within your organisation with the developer role will be able to see and manage API keys.

You can create API keys for each application that connects to your account, this means that you can terminate any applications access at any time.

Authentication is achieved by supplying the secret key as a header called Smart-Auth in your requests to the Smart Gift API endpoints.

Headers

In the header you must pass the following arguments:


  1. Smart-Auth: This is the secret key that authenticates the request. This is created in the Smart gift dashboard under Developers > Applications. If you do not pass this you will receive an error informing you that the header is not present or is incorrect.
  2. Content-Type: The format of the request you are sending. This must be application/json.
  3. Accept: This informs the server of the format of the expected response. This must be application/json. If you fail to pass this, error messages will not be returned properly in json format.


Please see the below examples for how to include these headers.


Curl

 curl -i -H "Smart-Auth: sk_xxxxxxxxxxxxxx" "Accept: application/json" -H "Content-Type: application/json" https://api.smart-gift.co.uk/


Guzzle

  $client = new Client();
  $response = $client->post(env('API_URL', 'https://api.smart-gift.co.uk/')', [
      'headers' => [
          'Content-Type' => 'application/json',
          'Accept' => 'application/json',
          'Smart-Auth' => 'sk_xxxxxxxxxxxxxx'
      ]
  ]);


Registration

If you would like access to the Development environment for testing processing of sales etc. please contact support.