Create a client installation
curl --request POST \
--url https://external.pleo.io/v1/installations/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"metadata": {
"externalConfigurationId": "123456789"
}
}
'import requests
url = "https://external.pleo.io/v1/installations/me"
payload = { "metadata": { "externalConfigurationId": "123456789" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify({metadata: {externalConfigurationId: '123456789'}})
};
fetch('https://external.pleo.io/v1/installations/me', 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://external.pleo.io/v1/installations/me",
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([
'metadata' => [
'externalConfigurationId' => '123456789'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$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://external.pleo.io/v1/installations/me"
payload := strings.NewReader("{\n \"metadata\": {\n \"externalConfigurationId\": \"123456789\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://external.pleo.io/v1/installations/me")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"metadata\": {\n \"externalConfigurationId\": \"123456789\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.pleo.io/v1/installations/me")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"metadata\": {\n \"externalConfigurationId\": \"123456789\"\n }\n}"
response = http.request(request)
puts response.read_body{
"applicationId": "123e4567-e89b-12d3-a456-426614174000",
"createdAt": "2021-01-01T00:00:00Z",
"id": "123e4567-e89b-12d3-a456-426614174000",
"metadata": {
"key": "value"
},
"resource": "urn:pleo:company:123e4567-e89b-12d3-a456-426614174000",
"status": "ACTIVATED",
"updatedAt": "2021-01-01T00:00:00Z",
"deletedAt": "2021-01-01T00:00:00Z",
"errorCode": "NOT_ENTITLED"
}Installations
Create a client installation
The integration sends a request to this endpoint to create an installation. This is required, especially when API keys are used for authorisation.
POST
/
v1
/
installations
/
me
Create a client installation
curl --request POST \
--url https://external.pleo.io/v1/installations/me \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"metadata": {
"externalConfigurationId": "123456789"
}
}
'import requests
url = "https://external.pleo.io/v1/installations/me"
payload = { "metadata": { "externalConfigurationId": "123456789" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify({metadata: {externalConfigurationId: '123456789'}})
};
fetch('https://external.pleo.io/v1/installations/me', 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://external.pleo.io/v1/installations/me",
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([
'metadata' => [
'externalConfigurationId' => '123456789'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$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://external.pleo.io/v1/installations/me"
payload := strings.NewReader("{\n \"metadata\": {\n \"externalConfigurationId\": \"123456789\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://external.pleo.io/v1/installations/me")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"metadata\": {\n \"externalConfigurationId\": \"123456789\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external.pleo.io/v1/installations/me")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"metadata\": {\n \"externalConfigurationId\": \"123456789\"\n }\n}"
response = http.request(request)
puts response.read_body{
"applicationId": "123e4567-e89b-12d3-a456-426614174000",
"createdAt": "2021-01-01T00:00:00Z",
"id": "123e4567-e89b-12d3-a456-426614174000",
"metadata": {
"key": "value"
},
"resource": "urn:pleo:company:123e4567-e89b-12d3-a456-426614174000",
"status": "ACTIVATED",
"updatedAt": "2021-01-01T00:00:00Z",
"deletedAt": "2021-01-01T00:00:00Z",
"errorCode": "NOT_ENTITLED"
}Authorizations
bearerAuthbasicAuth
Body
application/json;charset=UTF-8
Installation request
| Value | Description |
|---|---|
| ACTIVATED | The installation is active and operational. |
| INACTIVE | The installation is inactive and not currently in use. |
| AUTHORIZED | The Pleo authorisation server has authorised the user, but the installation is not yet active or ready for use. |
| PENDING_INTEGRATION | The integration is synchronising or performing other background tasks. When an installation is in progress, the integration synchronises the user's Pleo account with the target application, so that tax codes, tags, and vendors are all similar in both Pleo and the third-party application. |
| ERROR | The installation has encountered an error and is not operational. An error code will be provided to explain the reason for the error. |
Available options:
ACTIVATED, INACTIVE, AUTHORIZED, PENDING_INTEGRATION, ERROR Response
Installation created.
Was this page helpful?