Download credits are a necessary component of the entire Value Added Reseller program. When you sign up as a Value Added Reseller, you will have an assigned Customer ID. Any future reloads of purchased download credits will be associated with this Customer ID.

This segment deals with how we can use the 123RF API to check for available download credits in the assigned Customer ID.

About the getCreditCount API Method

123RF’s getCreditCount API method (123rf.customer.getCreditCount) requires the following arguments:

Arguments Description
apikey This APIkey is the commercial API key that you will be using to interface with 123RF
accesskey This key is only given to the commercial key holder
custid The customer ID is unique to you – this information will be given once you have signed up for the Value Added Reseller Program

Please note that in order for this method to work you need to “sign” it with the “APIsign” method (API signature (apisign)). We’ll go through this tutorial so that you can understand the API sign better and how it works in the big scheme of things.

Step 1: Compiling the necessary information

In this example, we will be using 3 pieces of information:

  1. Commercial API Key = b59e8b113748a3a0676045573eb667b2
    Available from – look under Commercial Key section
  2. Secret Key = 8b5be6e0fad722
    Available from – look under Commercial Key section
  3. Access Key = 44dacbef
    Available from, click on the “Additional Info” link for the Commercial Key above.
  4. Customer ID = b55310528064e5e
    Customer ID is given to you once you join the VAR program.

Now that we have gotten the necessary information, we can proceed to create the API sign which is another required argument to be sent to the API call.

Step 2: Generating the MD5 Hash for API Sign

In order to create the MD5 hash for API sign, we need to first determine the required arguments that have to be passed to the API call. This is the example that the documentation has given us:

It is then evident that we require :

  1. apikey
  2. custid
  3. accesskey
  4. apisign

Next, according to the APIsign documentation, we need to create the API signatures (apisigns) by using a combination of the secretkey and other arguments needed by API call in alphabetical order, argument name followed by the value.

The structure of the API signature looks like this: <secretKey>accesskey<accesskey>apikey<apikey>custid<custid>method<method>
Plugging in the variables gives us this string:


Next, we need to pass this through a MD5 hash (using MySQL or PHP) to yield:

Step 3: Constructing the URL that will be passed to the API method

Now, we will construct the URL that the API call is expecting, and append the API sign at the back. We then have:

You may click on the link above to see that the XML returned looks something like this:

123RF checkCredits Successful

Therefore, if you have enough credits, you may now download the required content from within your application, which we will find out in the installment of the tutorial.