Skip to main content
POST
/
timmi-project
/
api
/
v4
/
clients
Create a new Client
curl --request POST \
  --url https://{host}/timmi-project/api/v4/clients \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "code": "<string>",
  "organizationId": 123,
  "externalCode": "<string>",
  "ownerId": 123
}
'
import requests

url = "https://{host}/timmi-project/api/v4/clients"

payload = {
"name": "<string>",
"code": "<string>",
"organizationId": 123,
"externalCode": "<string>",
"ownerId": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
code: '<string>',
organizationId: 123,
externalCode: '<string>',
ownerId: 123
})
};

fetch('https://{host}/timmi-project/api/v4/clients', 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://{host}/timmi-project/api/v4/clients",
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([
'name' => '<string>',
'code' => '<string>',
'organizationId' => 123,
'externalCode' => '<string>',
'ownerId' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);

$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://{host}/timmi-project/api/v4/clients"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"organizationId\": 123,\n \"externalCode\": \"<string>\",\n \"ownerId\": 123\n}")

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

req.Header.Add("Authorization", "<authorization>")
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://{host}/timmi-project/api/v4/clients")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"organizationId\": 123,\n \"externalCode\": \"<string>\",\n \"ownerId\": 123\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{host}/timmi-project/api/v4/clients")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"organizationId\": 123,\n \"externalCode\": \"<string>\",\n \"ownerId\": 123\n}"

response = http.request(request)
puts response.read_body
{
  "name": "<string>",
  "code": "<string>",
  "id": 123,
  "externalCode": "<string>",
  "owner": {
    "id": 2,
    "firstName": "<string>",
    "lastName": "<string>",
    "dtContractEnd": "<string>",
    "picture": {
      "href": "<string>"
    },
    "establishmentId": 2
  }
}
{
"type": "<string>",
"title": "<string>",
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errors": {}
}
{
"type": "<string>",
"title": "<string>",
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errors": {}
}
{
"type": "<string>",
"title": "<string>",
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errors": {}
}
{
"type": "<string>",
"title": "<string>",
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errors": {}
}
{
"type": "<string>",
"title": "<string>",
"traceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"errors": {}
}

Headers

Authorization
string
required

API key. Value must be formatted like so: lucca application={api_key}.

Body

application/json

A client must belong to a single organization [blocked].

The organizationId field is required upon creation (POST) and cannot be modified later.

name
string
required
Minimum string length: 1
code
string
required

Unique code for this client. Used for identifying the client in invoices export if externalCode is null.

Minimum string length: 1
organizationId
integer
required
write-only

Unique identifier of the organization [blocked] this client belongs to.

externalCode
null | string

Used for identifying the client in invoices exports. Is not subject to unicity.

ownerId
null | integer
write-only

Unique identifier of the user managing this client.

Response

Created

A client must belong to a single organization [blocked].

The organizationId field is required upon creation (POST) and cannot be modified later.

name
string
required
Minimum string length: 1
code
string
required

Unique code for this client. Used for identifying the client in invoices export if externalCode is null.

Minimum string length: 1
id
number
read-only
externalCode
null | string

Used for identifying the client in invoices exports. Is not subject to unicity.

owner
null | object
read-only