Lieferanten erstellen oder aktualisieren
curl --request POST \
--url https://api.comstruct.com/v1/suppliers \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
[
{
"external_id": "SUP-001",
"title": "Acme GmbH",
"legal_uid": "DE123456789",
"country_code": "DE",
"comment": "Bevorzugter Kontakt per E-Mail",
"withholding_tax_code": "00",
"address": "Musterstraße 1",
"city": "Berlin",
"zip": "10115",
"is_active": true,
"supplier_bank_details": [
{
"external_id": "BANK-001",
"iban": "DE89370400440532013000"
}
]
}
]
'import requests
url = "https://api.comstruct.com/v1/suppliers"
payload = [
{
"external_id": "SUP-001",
"title": "Acme GmbH",
"legal_uid": "DE123456789",
"country_code": "DE",
"comment": "Bevorzugter Kontakt per E-Mail",
"withholding_tax_code": "00",
"address": "Musterstraße 1",
"city": "Berlin",
"zip": "10115",
"is_active": True,
"supplier_bank_details": [
{
"external_id": "BANK-001",
"iban": "DE89370400440532013000"
}
]
}
]
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
external_id: 'SUP-001',
title: 'Acme GmbH',
legal_uid: 'DE123456789',
country_code: 'DE',
comment: 'Bevorzugter Kontakt per E-Mail',
withholding_tax_code: '00',
address: 'Musterstraße 1',
city: 'Berlin',
zip: '10115',
is_active: true,
supplier_bank_details: [{external_id: 'BANK-001', iban: 'DE89370400440532013000'}]
}
])
};
fetch('https://api.comstruct.com/v1/suppliers', 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.comstruct.com/v1/suppliers",
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([
[
'external_id' => 'SUP-001',
'title' => 'Acme GmbH',
'legal_uid' => 'DE123456789',
'country_code' => 'DE',
'comment' => 'Bevorzugter Kontakt per E-Mail',
'withholding_tax_code' => '00',
'address' => 'Musterstraße 1',
'city' => 'Berlin',
'zip' => '10115',
'is_active' => true,
'supplier_bank_details' => [
[
'external_id' => 'BANK-001',
'iban' => 'DE89370400440532013000'
]
]
]
]),
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://api.comstruct.com/v1/suppliers"
payload := strings.NewReader("[\n {\n \"external_id\": \"SUP-001\",\n \"title\": \"Acme GmbH\",\n \"legal_uid\": \"DE123456789\",\n \"country_code\": \"DE\",\n \"comment\": \"Bevorzugter Kontakt per E-Mail\",\n \"withholding_tax_code\": \"00\",\n \"address\": \"Musterstraße 1\",\n \"city\": \"Berlin\",\n \"zip\": \"10115\",\n \"is_active\": true,\n \"supplier_bank_details\": [\n {\n \"external_id\": \"BANK-001\",\n \"iban\": \"DE89370400440532013000\"\n }\n ]\n }\n]")
req, _ := http.NewRequest("POST", 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.post("https://api.comstruct.com/v1/suppliers")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"external_id\": \"SUP-001\",\n \"title\": \"Acme GmbH\",\n \"legal_uid\": \"DE123456789\",\n \"country_code\": \"DE\",\n \"comment\": \"Bevorzugter Kontakt per E-Mail\",\n \"withholding_tax_code\": \"00\",\n \"address\": \"Musterstraße 1\",\n \"city\": \"Berlin\",\n \"zip\": \"10115\",\n \"is_active\": true,\n \"supplier_bank_details\": [\n {\n \"external_id\": \"BANK-001\",\n \"iban\": \"DE89370400440532013000\"\n }\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.comstruct.com/v1/suppliers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"external_id\": \"SUP-001\",\n \"title\": \"Acme GmbH\",\n \"legal_uid\": \"DE123456789\",\n \"country_code\": \"DE\",\n \"comment\": \"Bevorzugter Kontakt per E-Mail\",\n \"withholding_tax_code\": \"00\",\n \"address\": \"Musterstraße 1\",\n \"city\": \"Berlin\",\n \"zip\": \"10115\",\n \"is_active\": true,\n \"supplier_bank_details\": [\n {\n \"external_id\": \"BANK-001\",\n \"iban\": \"DE89370400440532013000\"\n }\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"count": 1
}{
"error": "<string>",
"message": "<string>"
}{
"error": "Unauthorized. Key is not linked to any customer."
}{
"error": "Unauthorized. Missing scope: suppliers:write"
}{
"error": "<string>"
}Suppliers
Create or update suppliers
Erforderliche Berechtigungen: suppliers:write
Erstellt oder aktualisiert Lieferanten des aktuellen Kunden. Der Abgleich erfolgt über external_id.
Bankverbindungen werden anhand der IBAN zusammengeführt.
payment_term_id und default_account_id sind UUIDs im comstruct-Mandanten.
Der API-Schlüssel muss mit einem Kunden verknüpft sein.
POST
/
suppliers
Lieferanten erstellen oder aktualisieren
curl --request POST \
--url https://api.comstruct.com/v1/suppliers \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
[
{
"external_id": "SUP-001",
"title": "Acme GmbH",
"legal_uid": "DE123456789",
"country_code": "DE",
"comment": "Bevorzugter Kontakt per E-Mail",
"withholding_tax_code": "00",
"address": "Musterstraße 1",
"city": "Berlin",
"zip": "10115",
"is_active": true,
"supplier_bank_details": [
{
"external_id": "BANK-001",
"iban": "DE89370400440532013000"
}
]
}
]
'import requests
url = "https://api.comstruct.com/v1/suppliers"
payload = [
{
"external_id": "SUP-001",
"title": "Acme GmbH",
"legal_uid": "DE123456789",
"country_code": "DE",
"comment": "Bevorzugter Kontakt per E-Mail",
"withholding_tax_code": "00",
"address": "Musterstraße 1",
"city": "Berlin",
"zip": "10115",
"is_active": True,
"supplier_bank_details": [
{
"external_id": "BANK-001",
"iban": "DE89370400440532013000"
}
]
}
]
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
external_id: 'SUP-001',
title: 'Acme GmbH',
legal_uid: 'DE123456789',
country_code: 'DE',
comment: 'Bevorzugter Kontakt per E-Mail',
withholding_tax_code: '00',
address: 'Musterstraße 1',
city: 'Berlin',
zip: '10115',
is_active: true,
supplier_bank_details: [{external_id: 'BANK-001', iban: 'DE89370400440532013000'}]
}
])
};
fetch('https://api.comstruct.com/v1/suppliers', 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.comstruct.com/v1/suppliers",
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([
[
'external_id' => 'SUP-001',
'title' => 'Acme GmbH',
'legal_uid' => 'DE123456789',
'country_code' => 'DE',
'comment' => 'Bevorzugter Kontakt per E-Mail',
'withholding_tax_code' => '00',
'address' => 'Musterstraße 1',
'city' => 'Berlin',
'zip' => '10115',
'is_active' => true,
'supplier_bank_details' => [
[
'external_id' => 'BANK-001',
'iban' => 'DE89370400440532013000'
]
]
]
]),
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://api.comstruct.com/v1/suppliers"
payload := strings.NewReader("[\n {\n \"external_id\": \"SUP-001\",\n \"title\": \"Acme GmbH\",\n \"legal_uid\": \"DE123456789\",\n \"country_code\": \"DE\",\n \"comment\": \"Bevorzugter Kontakt per E-Mail\",\n \"withholding_tax_code\": \"00\",\n \"address\": \"Musterstraße 1\",\n \"city\": \"Berlin\",\n \"zip\": \"10115\",\n \"is_active\": true,\n \"supplier_bank_details\": [\n {\n \"external_id\": \"BANK-001\",\n \"iban\": \"DE89370400440532013000\"\n }\n ]\n }\n]")
req, _ := http.NewRequest("POST", 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.post("https://api.comstruct.com/v1/suppliers")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"external_id\": \"SUP-001\",\n \"title\": \"Acme GmbH\",\n \"legal_uid\": \"DE123456789\",\n \"country_code\": \"DE\",\n \"comment\": \"Bevorzugter Kontakt per E-Mail\",\n \"withholding_tax_code\": \"00\",\n \"address\": \"Musterstraße 1\",\n \"city\": \"Berlin\",\n \"zip\": \"10115\",\n \"is_active\": true,\n \"supplier_bank_details\": [\n {\n \"external_id\": \"BANK-001\",\n \"iban\": \"DE89370400440532013000\"\n }\n ]\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.comstruct.com/v1/suppliers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"external_id\": \"SUP-001\",\n \"title\": \"Acme GmbH\",\n \"legal_uid\": \"DE123456789\",\n \"country_code\": \"DE\",\n \"comment\": \"Bevorzugter Kontakt per E-Mail\",\n \"withholding_tax_code\": \"00\",\n \"address\": \"Musterstraße 1\",\n \"city\": \"Berlin\",\n \"zip\": \"10115\",\n \"is_active\": true,\n \"supplier_bank_details\": [\n {\n \"external_id\": \"BANK-001\",\n \"iban\": \"DE89370400440532013000\"\n }\n ]\n }\n]"
response = http.request(request)
puts response.read_body{
"count": 1
}{
"error": "<string>",
"message": "<string>"
}{
"error": "Unauthorized. Key is not linked to any customer."
}{
"error": "Unauthorized. Missing scope: suppliers:write"
}{
"error": "<string>"
}Authorizations
Body
application/json