API Development - Error codes

Sample Code C - Cibcurl

CURL *curl;
CURLcode res;

// The URL to which we will send the POST request
const char *url = "https://fcsapi.com/api-v3/forex/latest";

// Create form data with parameters
const char *postfields = "id=1,2,3&access_key=API_KEY";

// Initialize libcurl
curl = curl_easy_init();

  // Set the URL for the POST request
  curl_easy_setopt(curl, CURLOPT_URL, url);

  // Specify that this is a POST request
  curl_easy_setopt(curl, CURLOPT_POST, 1L);

  // Set the POST fields
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postfields);

  // Perform the request, res will get the return code
  res = curl_easy_perform(curl);

  // Check for errors
  if(res != CURLE_OK)
    fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));

  // Always cleanup
// Global cleanup
return 0;

Sample Code C# - Restshar

// Initialize the client with the base URL
var client = new RestClient("https://fcsapi.com/api-v3/forex/latest");

// Create a POST request
var request = new RestRequest(Method.POST);

// Create form data with parameters
request.AddParameter("id", "1,2,3");
request.AddParameter("access_key", "API_KEY");

// Execute the request and get the response
IRestResponse response = client.Execute(request);

// Print the response

Sample Code cURL

# Use curl to make a POST request to the specified URL
curl -X POST https://fcsapi.com/api-v3/forex/latest \
  # Create form data with parameters
  -d "id=1,2,3" \
  -d "access_key=API_KEY"

Sample Code Go - Native

package main

import (


func main() {
  apiUrl := "https://fcsapi.com/api-v3/forex/latest"

  // Create form data with parameters
  data := url.Values{}
  data.Set("id", "1,2,3")
  data.Set("access_key", "API_KEY")

  // Create a new POST request
  req, err := http.NewRequest("POST", apiUrl, bytes.NewBufferString(data.Encode()))
  if err != nil {
    fmt.Println("Error creating request:", err)

  // Set content type header
  req.Header.Set("Content-Type", "application/x-www-form-urlencoded")

  // Perform the request
  client := &http.Client{}
  resp, err := client.Do(req)

  if err != nil {
    fmt.Println("Error making request:", err)

  defer resp.Body.Close()

  // Print response status
  fmt.Println("Response status:", resp.Status)

Sample Code Java - OkHttp

OkHttpClient client = new OkHttpClient();

// Create form data with parameters
RequestBody requestBody = new FormBody.Builder();
  .add("id", "1,2,3")
  .add("access_key", "API_KEY")

// Create the request
Request request = new Request.Builder();

// Execute the request and get the response
try (Response response = client.newCall(request).execute()) {
  if (!response.isSuccessful()) {
    throw new IOException("Unexpected code " + response);

  // Print the response body

Sample Code Java - Unirest

// Make a POST request using Unirest
HttpResponse<String> response = Unirest.post("https://fcsapi.com/api-v3/forex/latest")
  // Set the Content-Type header
  .header("Content-Type", "application/x-www-form-urlencoded")
  // Create form data with parameters
  .field("id", "1,2,3")
  .field("access_key", "API_KEY")
  // Execute the request and get the response

// Print the response body

Sample Code Java - AsyncHttp

// Create an instance of AsyncHttpClient
AsyncHttpClient asyncHttpClient = Dsl.asyncHttpClient();

// Build the POST request
Request Request = Dsl.post("https://fcsapi.com/api-v3/forex/latest");
  // Create form data with parameters
  .addFormParam("id", "1,2,3")
  .addFormParam("access_key", "API_KEY")

// Execute the request asynchronously
  .thenAccept(response -> {
    // Print the response status code
    System.out.println("Response status code: " + response.getStatusCode());

    // Print the response body
    System.out.println("Response body: " + response.getResponseBody());

// Close the AsyncHttpClient instance

Sample Code JavaScript Fetch

// Create form data with parameters
const formData = new FormData();
formData.append("id", "1,2,3");
formData.append("access_key", "API_KEY");

// Send a POST request to the API
fetch("https://fcsapi.com/api-v3/forex/latest", {
  method: "POST",
  headers: {
    // Set content type to form-urlencoded
    "Content-Type": "application/x-www-form-urlencoded"
  body: formData

// Parse the JSON response
.then(response => response.json())

// Log the data to the console
.then(data => console.log(data))

// Log any errors to the console
.catch(error => console.error("Error:", error))

Sample Code jQuery.ajax

Real-time rates: Find below a simple jQuery.ajax example of getting exchange rate data via the FCS API's latest endpoint.

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
access_key = "API_KEY"; // Your API access key, Signup to get API KEY
id = '1,2,3,4'; // Forex ids

"https://fcsapi.com/api-v3/forex/latest?id=" + id + "&access_key=" + access_key,
"GET", // GET or POST
    success: function(data) {
        console.log("Price of "+data.response[0].symbol + " is "+data.response[0].price);// Price of EUR/USD is 1.1064;


Sample Code JavaScript XHR

// Create form data with parameters
var formData = new FormData();
formData.append("id", "1,2,3");
formData.append("access_key", "API_KEY");

// Create a new XMLHttpRequest object
var xhr = new XMLHttpRequest();

// Configure the request
xhr.open("POST", "https://fcsapi.com/api-v3/forex/latest", true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

// Set up a function to handle the response
xhr.onreadystatechange = function() {
  if (xhr.readyState == 4 && xhr.status == 200) {
    // Request was successful, handle the response here

// Send the request with the parameters

Sample Code NodeJs Request

// Require the 'request' library
const request = require('request');

// Define the request options
const options = {
  url: "https://fcsapi.com/api-v3/forex/latest",
  method: "POST",

  // Create form data with parameters
  form: {
    id: '1,2,3',
    access_key: 'API_KEY',

// Make the HTTP request
request(options, function (error, response, body) {
  if (error) {
    console.error('Error:', error);
  else {
    console.log('Response:', body);

Sample Code NodeJs Unirest

// Require the 'unirest' library
const unirest = require('unirest');

// Make a POST request to the specified URL
  .headers({'Content-Type': 'application/json'})
  // Create form data with parameters
  .field('id', "1,2,3")
  .field('access_key', "API_KEY")
  .end(function (response) {

Sample Code NodeJs Axios

// Require the 'axios' library
const axios = require('axios');

// Create form data with parameters
const data = {
  id: '1,2,3',
  access_key: 'API_KEY'

// Making a POST request using Axios
axios.post("https://fcsapi.com/api-v3/forex/latest", data)
  .then(response => {
  .catch(error => {
    console.error("error", error);

Sample Code PHP cURL

$access_key = "API_KEY"; // Your API access key, Signup to get API KEY
$symbol = "EUR/USD"; // FX Pairs

// Enter your API URL below
$api_url = "https://fcsapi.com/api-v3/forex/latest";
$post = "symbol=".$symbol."&access_key=".$access_key;

// Initialize CURL:
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$json = curl_exec($ch); // Store the data

$response = json_decode($json, true); // convert JSON into Array
foreach ($response['response'] as $key => $value) {
  echo "<br>Open Price Of ".$value['symbol']." is ".$value['price']; // Open Price Of EUR/USD is 1.1266

Sample Code PHP pecl_http

// Create form data with parameters
$data = array(
  'id' => '1,2,3',
  'access_key' => 'API_KEY',

Set POST data
$data_query = http_build_query($data);

// Initialize a new HTTP request
$request = new HttpRequest("https://fcsapi.com/api-v3/forex/latest", HttpRequest::METH_POST);
  'Content-Type' => 'application/x-www-form-urlencoded',


// Send the request and capture the response
try {
  $response = $request->send();

  // Display the response
  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;

Sample Code Python Requests

import requests

# Create form data with parameters
params = {
  "id": "1,2,3",
  "access_key": "API_KEY"

# Make the POST request
response = requests.post("https://fcsapi.com/api-v3/forex/latest", data=params)

# Print the response

Sample Code Ruby Net::HTTP

require 'uri'
require 'net/http'

url = URI("https://fcsapi.com/api-v3/forex/latest")

# Create form data with parameters
params = {
  "id": "1,2,3",
  "access_key": "API_KEY"

# Create the HTTP object
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

# Create the request
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/x-www-form-urlencoded"

# Send the request
response = http.request(request)

# Output the response
puts "Response code: #{response.code}"
puts "Response body: #{response.body}"

Sample Code Shell Httpi

http --ignore-stdin --form --follow --timeout 3600 POST 'https://fcsapi.com/api-v3/forex/latest' \
  # Create form data with parameters
  "id"="1,2,3" \

Sample Code Shell wget

wget --quiet \
  --method=POST \
  --header='Content-Type: application/x-www-form-urlencoded' \
  --body-data='id=1,2,3&access_key=API_KEY' \
  --output-document=- \


There are multiple errors that help you to understand issue with your API response.

Code Details
200 Your API is working. Response successfully
101 API Key error : Your access key is wrong, Please login in your dashboard and get your API KEY.
102 Your Account is not activated.
103 Your Account is blocked.
104 API Key error : You have not set your access_key in parameters.
111 Full access is not allow with DEMO API key, so please signup and get your api key to unlock full access on FCS.
112 Data not found, it may be you set wrong values and it may be no data from our side. More error details will be send in API response.
113 Required parameters are missing, Please check api documentaion also check message in API response for more error details.
211 You have used your all monthly API request limit.
212 Your Account is expired, You need to pay your montly fee or downgrade to free version.
213 Error 213 is only for Free user, free user are not allow more than 1 request per minute..