Skip to main content
POST
/
accounting
/
contacts
Create Contacts
curl --request POST \
  --url https://api.rootfi.dev/accounting/contacts \
  --header 'Content-Type: application/json' \
  --header 'api_key: <api-key>' \
  --data '
{
  "company_id": 1,
  "data": [
    {
      "name": "Rootfi Test",
      "contact_name": "Rootfi Test",
      "contact_type": "CUSTOMER",
      "currency_id": "GBP",
      "tax_number": "1234567890",
      "registration_number": "1234567890",
      "email": ""
    }
  ]
}
'
import requests

url = "https://api.rootfi.dev/accounting/contacts"

payload = {
"company_id": 1,
"data": [
{
"name": "Rootfi Test",
"contact_name": "Rootfi Test",
"contact_type": "CUSTOMER",
"currency_id": "GBP",
"tax_number": "1234567890",
"registration_number": "1234567890",
"email": ""
}
]
}
headers = {
"api_key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {api_key: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
company_id: 1,
data: [
{
name: 'Rootfi Test',
contact_name: 'Rootfi Test',
contact_type: 'CUSTOMER',
currency_id: 'GBP',
tax_number: '1234567890',
registration_number: '1234567890',
email: ''
}
]
})
};

fetch('https://api.rootfi.dev/accounting/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.rootfi.dev/accounting/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'company_id' => 1,
'data' => [
[
'name' => 'Rootfi Test',
'contact_name' => 'Rootfi Test',
'contact_type' => 'CUSTOMER',
'currency_id' => 'GBP',
'tax_number' => '1234567890',
'registration_number' => '1234567890',
'email' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.rootfi.dev/accounting/contacts"

payload := strings.NewReader("{\n \"company_id\": 1,\n \"data\": [\n {\n \"name\": \"Rootfi Test\",\n \"contact_name\": \"Rootfi Test\",\n \"contact_type\": \"CUSTOMER\",\n \"currency_id\": \"GBP\",\n \"tax_number\": \"1234567890\",\n \"registration_number\": \"1234567890\",\n \"email\": \"\"\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("api_key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.rootfi.dev/accounting/contacts")
.header("api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"company_id\": 1,\n \"data\": [\n {\n \"name\": \"Rootfi Test\",\n \"contact_name\": \"Rootfi Test\",\n \"contact_type\": \"CUSTOMER\",\n \"currency_id\": \"GBP\",\n \"tax_number\": \"1234567890\",\n \"registration_number\": \"1234567890\",\n \"email\": \"\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.rootfi.dev/accounting/contacts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"company_id\": 1,\n \"data\": [\n {\n \"name\": \"Rootfi Test\",\n \"contact_name\": \"Rootfi Test\",\n \"contact_type\": \"CUSTOMER\",\n \"currency_id\": \"GBP\",\n \"tax_number\": \"1234567890\",\n \"registration_number\": \"1234567890\",\n \"email\": \"\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "status": "SUCCESS",
    "upload_job_id": "xQm2K441VosP8W4",
    "data": [
      {
        "job_id": "aXI9pUDA5T7E2LS",
        "status": "success",
        "response": {
          "platform_id": "3770712000001686001",
          "currency_id": "3770712000000000099",
          "name": "Mr. John Doe",
          "contact_name": "John Doe",
          "contact_type": "CUSTOMER",
          "tax_number": "ODSPS1279G",
          "registration_number": "07CEUPK5322M1ZX",
          "status": "ACTIVE",
          "updated_at": "2023-11-01T00:00:00.000Z",
          "raw_data": {
            "platform_id": "1013",
            "name": "Mr. John Doe",
            "contact_name": "Mr. John Doe",
            "contact_type": "CUSTOMER",
            "currency_id": "1",
            "status": "ARCHIVED"
          }
        },
        "error": null
      }
    ]
  },
  "request_timestamp": "2023-10-25T13:39:41.201Z",
  "response_timestamp": "2023-10-25T13:39:41.201Z",
  "request_id": "7a1c0e42-9f85-4d6e-bb5d-358a72913c0b"
}
A contact is an individual or company that buys or sells goods or services from a business. Commonly referred to a customer on a corresponding invoice or a vendor for a bill

Additional Required Fields

To successfully create a contact, certain fields must be included in the raw_data object of the request body. The required fields are as follows:
IntegrationFieldDescriptionRequired
MS_DYNAMICS_365_FOCustomerGroupIdThe customer group ID to which the contact belongs. This should be passed if the contact_type is CUSTOMER.Yes
MS_DYNAMICS_365_FOVendorGroupIdThe vendor group ID to which the contact belongs. This should be passed if the contact_type is VENDOR.Yes
MYOB_BUSINESStax_codeThe tax code to which the contact belongs.Yes
SAGE_ZA_CLOUD_ACCOUNTINGcodeThe code of the contact.Yes

Authorizations

api_key
string
header
required

Body

application/json

Create contacts

company_id
integer
required

The company ID

Example:

1

data
accountingtypesContactsWriteRequestFields · object[]
required

The data to be passed through to the integration platform

Response

200 - application/json
data
accountingtypesCreateContactsResponseData · object
required
request_timestamp
string<date-time>
required

The time at which the request was received by the server

response_timestamp
string<date-time>
required

The time at which the response was sent by the server

request_id
string
required

The unique ID of the request