Create an API key on Tether

Knowledge Base

Create an API key on Tether

An API Key is a one-of-a-kind credential that is used to authenticate requests linked with your account.

The Authenticated API on Tether grants you restricted access to your Tether account on the platform, allowing you to retrieve limited account data. This requires a Tether Account and the associated API keys.

How to create an API key on Tether

  1. Firstly log in to your Tether account 

  2. Then navigate to the API key management page

  3. Once on the page to create a key, press the Create Key button and select the desired permissions.

Note: You can generate new API keys and revoke current ones from this page.

How to create Authenticated Requests on Tether

When creating authenticated calls, the domain https://app.tether.to should be used.

Authentication is achieved through the signing of the request details with the user API secret and then passing the API key and base 64 encoded signature in the header along with the request to be verified.

Below is an example in Ruby for interacting with the authenticated endpoints. The following assumptions are made:

  • You are using your API key and API Secret key;

  • Your signature variable follows the same format that is listed below.

require 'time'

require 'httparty'

@base_uri = 'https://app.tether.to/api/v1'

@api_key = 'YOUR-KEY'

@api_secret = 'YOUR-SECRET'


def b64_encode(string)

  Base64.strict_encode64(string)

end


def md5_base64digest(string)

  Digest::MD5.base64digest(string)

end


def hmac_signature(canonical_string)

  digest = OpenSSL::Digest.new('sha1')

  b64_encode(OpenSSL::HMAC.digest(digest, @api_secret, canonical_string))

end


def do_request(verb, uri, options={})

  path = @base_uri + uri


  if [:get, :delete].include? verb

    request_options = {}

    path = "#{@base_uri}#{uri}?#{URI.encode_www_form(options)}" unless options.empty?

    content_md5 = md5_base64digest('')

  else

    body = options.to_json

    request_options = { body: body }

    content_md5 = md5_base64digest(body)

  end


  # Generate valid headers and signature

  headers = {

      'Content-MD5' => content_md5,

      'Date' => Time.now.utc.httpdate,

      'Content-Type' => 'application/json',

  }

  canonical_string = [ verb.upcase,

                       headers['Content-Type'],

                       headers['Content-MD5'],

                       URI(@base_uri + uri).path,

                       headers['Date']

  ].join(',')


  signature = hmac_signature(canonical_string)

  headers['Authorization'] = "APIAuth #{@api_key}:#{signature}"

  request_options[:headers] = headers


  # forward to HTTParty

  response = HTTParty.send(verb, path, request_options)

  parsed_response = JSON.parse(response.body)

  parsed_response

end


def get(path, options={})

  do_request :get, path, options

end


## Define the functions to perform the authenticated calls


# returns current account balances

def balances

  get '/balances.json'

end


# returns list of most recent transactions

def transactions

  get '/transactions.json'

end


# returns specific page of transactions

def transactionPage(page)

  get "/transactions/page/#{page}"

end


# returns details of a specific transaction

def get_transaction(id)

  get "/transactions/#{id}.json"

end

If you have any questions feel free to contact Tether Support for further assistance. 

The Future of Money

Sign Up

Tether token

Tether supports and empowers growing ventures and innovation as a digital token built on multiple blockchains.

Copyright © 2013-2022 Tether Operations Limited. All rights reserved.