#Create New Client API

The following endpoint allows merchant to create new client in their Fatora Platform account.

https://api.fatora.io/v1/clients
curl --location 'https://api.fatora.io/v1/clients' \
--header 'api_key: E4B73FEE-F492-4607-A38D-852B0EBC91C9' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Client Name",
    "address": "Client Address",
    "phone": "Client Phone",
    "email": "[email protected]",
    "notes": "Additional notes"
}'

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fatora.io/v1/clients',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{
    "name": "Client Name",
    "address": "Client Address",
    "phone": "Client Phone",
    "email": "[email protected]",
    "notes": "Additional notes"
}',
  CURLOPT_HTTPHEADER => array(
    'api_key: E4B73FEE-F492-4607-A38D-852B0EBC91C9',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

// Define the API endpoint URL.
string apiUrl = "https://maktappadmin.azurewebsites.net/v1/clients";

// Define the API key.
string apiKey = "E4B73FEE-F492-4607-A38D-852B0EBC91C9";

var client = new Client
{
    Name = "Client Name",
    Phone = "Client Phone",
    Email = "[email protected]",
    Address = "Client Address",
    Note = "Additional notes"
};

// Serialize the Client object to JSON.
string jsonPayload = JsonConvert.SerializeObject(client);

// Create a WebRequest.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);

// Set the request method to POST.
request.Method = "POST";

// Set the API key header.
request.Headers.Add("api_key", apiKey);

// Set the request content type.
request.ContentType = "application/json";

// Convert the JSON payload to bytes.
byte[] data = Encoding.UTF8.GetBytes(jsonPayload);

// Set the content length.
request.ContentLength = data.Length;

// Get the request stream and write the JSON data to it.
using (var stream = request.GetRequestStream())
{
    stream.Write(data, 0, data.Length);
}

try
{
    // Get the response.
    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
    {
        if (response.StatusCode == HttpStatusCode.Created)
        {
            // Read the response data.
            using (var responseStream = response.GetResponseStream())
            using (var reader = new System.IO.StreamReader(responseStream))
            {
                string responseContent = reader.ReadToEnd();
                Console.WriteLine("API Response: " + responseContent);
            }
        }
        else
        {
            Console.WriteLine("API Request failed with status code: " + response.StatusCode);
        }
    }
}
catch (WebException ex)
{
    Console.WriteLine("API Request failed with an exception: " + ex.Message);
}

{
"status": "SUCCESS",
"client": {
    "id": 123,
    "name": "Client Name",
    "phone": "Client Phone",
    "email": "[email protected]",
    "address": "Client Address",
    "note": "Additional notes"
}
}

Try it now: Add Client API

Header Parameters

Header Value
api_key REQUIRED Use the valid API key of your Fatora account. Read more information about Authentication.
Content-Type REQUIRED application/json

Request Parameters

Parameter Description
name REQUIRED string The client's full name.
phone OPTIONAL string The client's phone number.
email REQUIRED string The client's email address.
address OPTIONAL string The client's address.
notes OPTIONAL string Additional information.

Response

Response Schema: application/json
status string the status of response.
SUCCESS
client object:
  • id: int the id of client
  • name: string The client`s full name
  • phone: string The client's phone number
  • email: string The client's email address.
  • address: string The client's address.
  • notes: string The client's notes.

Otherwise if there was a problem with your request, you'll receive an error response such as 400 status code, and the response will include an error object describing why this request failed.

Response Schema: application/json
status string The status of response.
error object:
  • error_code string, the naumber of error: e.g: 400, For more information
    see Response Code
  • description string, the description of error: e.g: bad request
technical-support

🛠️ Technical Support