cURL
curl --request PUT \
--url https://app.revyops.com/api/public/v2/companies \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"domain": "<string>",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"field_name": "<string>",
"field_value": "<string>"
}
]
}
'import requests
url = "https://app.revyops.com/api/public/v2/companies"
payload = {
"domain": "<string>",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"field_name": "<string>",
"field_value": "<string>"
}
]
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
domain: '<string>',
name: '<string>',
company_status: '<string>',
company_custom_fields: [{field_name: '<string>', field_value: '<string>'}]
})
};
fetch('https://app.revyops.com/api/public/v2/companies', 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://app.revyops.com/api/public/v2/companies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'domain' => '<string>',
'name' => '<string>',
'company_status' => '<string>',
'company_custom_fields' => [
[
'field_name' => '<string>',
'field_value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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://app.revyops.com/api/public/v2/companies"
payload := strings.NewReader("{\n \"domain\": \"<string>\",\n \"name\": \"<string>\",\n \"company_status\": \"<string>\",\n \"company_custom_fields\": [\n {\n \"field_name\": \"<string>\",\n \"field_value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-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.put("https://app.revyops.com/api/public/v2/companies")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"<string>\",\n \"name\": \"<string>\",\n \"company_status\": \"<string>\",\n \"company_custom_fields\": [\n {\n \"field_name\": \"<string>\",\n \"field_value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.revyops.com/api/public/v2/companies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"domain\": \"<string>\",\n \"name\": \"<string>\",\n \"company_status\": \"<string>\",\n \"company_custom_fields\": [\n {\n \"field_name\": \"<string>\",\n \"field_value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"domain": "<string>",
"previous_status": "<string>",
"status_changed_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"field_name": "<string>",
"field_value": "<string>"
}
]
}{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"domain": "<string>",
"previous_status": "<string>",
"status_changed_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"field_name": "<string>",
"field_value": "<string>"
}
]
}Companies
Create or Update Company
Creates or updates a company using its domain as the lookup key. If a company with the given domain exists for this client, it will be updated with the provided fields. Otherwise, a new company is created.
PUT
/
public
/
v2
/
companies
cURL
curl --request PUT \
--url https://app.revyops.com/api/public/v2/companies \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"domain": "<string>",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"field_name": "<string>",
"field_value": "<string>"
}
]
}
'import requests
url = "https://app.revyops.com/api/public/v2/companies"
payload = {
"domain": "<string>",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"field_name": "<string>",
"field_value": "<string>"
}
]
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
domain: '<string>',
name: '<string>',
company_status: '<string>',
company_custom_fields: [{field_name: '<string>', field_value: '<string>'}]
})
};
fetch('https://app.revyops.com/api/public/v2/companies', 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://app.revyops.com/api/public/v2/companies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'domain' => '<string>',
'name' => '<string>',
'company_status' => '<string>',
'company_custom_fields' => [
[
'field_name' => '<string>',
'field_value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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://app.revyops.com/api/public/v2/companies"
payload := strings.NewReader("{\n \"domain\": \"<string>\",\n \"name\": \"<string>\",\n \"company_status\": \"<string>\",\n \"company_custom_fields\": [\n {\n \"field_name\": \"<string>\",\n \"field_value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-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.put("https://app.revyops.com/api/public/v2/companies")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"domain\": \"<string>\",\n \"name\": \"<string>\",\n \"company_status\": \"<string>\",\n \"company_custom_fields\": [\n {\n \"field_name\": \"<string>\",\n \"field_value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.revyops.com/api/public/v2/companies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"domain\": \"<string>\",\n \"name\": \"<string>\",\n \"company_status\": \"<string>\",\n \"company_custom_fields\": [\n {\n \"field_name\": \"<string>\",\n \"field_value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"domain": "<string>",
"previous_status": "<string>",
"status_changed_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"field_name": "<string>",
"field_value": "<string>"
}
]
}{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"domain": "<string>",
"previous_status": "<string>",
"status_changed_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"company_status": "<string>",
"company_custom_fields": [
{
"id": 123,
"updated_time": "2023-11-07T05:31:56Z",
"field_name": "<string>",
"field_value": "<string>"
}
]
}Authorizations
Query Parameters
Domain to look up. If a company with this domain exists it will be updated; otherwise a new company is created.
Format of custom fields in response. NESTED returns array of objects with id, field_name, field_value. FLAT returns object with field names as keys.
Available options:
FLAT, NESTED Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Response
OK. The company already existed and was updated.
Was this page helpful?

