Create location
curl --request POST \
--url https://api.openfiskal.com/v1/locations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-OpenFiskal-Merchant: <x-openfiskal-merchant>' \
--data '
{
"name": "Main Store",
"address": {
"line1": "Musterstr. 1",
"city": "Berlin",
"postal_code": "10115",
"country_code": "DEU",
"line2": "Apt 4"
},
"timezone": "Europe/Berlin",
"external_id": "loc-001"
}
'import requests
url = "https://api.openfiskal.com/v1/locations"
payload = {
"name": "Main Store",
"address": {
"line1": "Musterstr. 1",
"city": "Berlin",
"postal_code": "10115",
"country_code": "DEU",
"line2": "Apt 4"
},
"timezone": "Europe/Berlin",
"external_id": "loc-001"
}
headers = {
"X-OpenFiskal-Merchant": "<x-openfiskal-merchant>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-OpenFiskal-Merchant': '<x-openfiskal-merchant>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Main Store',
address: {
line1: 'Musterstr. 1',
city: 'Berlin',
postal_code: '10115',
country_code: 'DEU',
line2: 'Apt 4'
},
timezone: 'Europe/Berlin',
external_id: 'loc-001'
})
};
fetch('https://api.openfiskal.com/v1/locations', 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.openfiskal.com/v1/locations",
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' => 'Main Store',
'address' => [
'line1' => 'Musterstr. 1',
'city' => 'Berlin',
'postal_code' => '10115',
'country_code' => 'DEU',
'line2' => 'Apt 4'
],
'timezone' => 'Europe/Berlin',
'external_id' => 'loc-001'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-OpenFiskal-Merchant: <x-openfiskal-merchant>"
],
]);
$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.openfiskal.com/v1/locations"
payload := strings.NewReader("{\n \"name\": \"Main Store\",\n \"address\": {\n \"line1\": \"Musterstr. 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"country_code\": \"DEU\",\n \"line2\": \"Apt 4\"\n },\n \"timezone\": \"Europe/Berlin\",\n \"external_id\": \"loc-001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-OpenFiskal-Merchant", "<x-openfiskal-merchant>")
req.Header.Add("Authorization", "Bearer <token>")
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.openfiskal.com/v1/locations")
.header("X-OpenFiskal-Merchant", "<x-openfiskal-merchant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Main Store\",\n \"address\": {\n \"line1\": \"Musterstr. 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"country_code\": \"DEU\",\n \"line2\": \"Apt 4\"\n },\n \"timezone\": \"Europe/Berlin\",\n \"external_id\": \"loc-001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openfiskal.com/v1/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-OpenFiskal-Merchant"] = '<x-openfiskal-merchant>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Main Store\",\n \"address\": {\n \"line1\": \"Musterstr. 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"country_code\": \"DEU\",\n \"line2\": \"Apt 4\"\n },\n \"timezone\": \"Europe/Berlin\",\n \"external_id\": \"loc-001\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"merchant_id": "<string>",
"name": "<string>",
"address": {
"line1": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "DEU",
"line2": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"timezone": "<string>"
}{
"code": "invalid_request",
"message": "The request body is malformed.",
"retryable": false
}{
"code": "unauthorized",
"message": "Authentication failed.",
"retryable": false
}{
"code": "forbidden",
"message": "The authenticated caller cannot access this resource.",
"retryable": false
}{
"code": "regime_validation_failed",
"message": "The payload violates regime-specific validation rules.",
"retryable": false
}Locations
Create location
POST
/
locations
Create location
curl --request POST \
--url https://api.openfiskal.com/v1/locations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-OpenFiskal-Merchant: <x-openfiskal-merchant>' \
--data '
{
"name": "Main Store",
"address": {
"line1": "Musterstr. 1",
"city": "Berlin",
"postal_code": "10115",
"country_code": "DEU",
"line2": "Apt 4"
},
"timezone": "Europe/Berlin",
"external_id": "loc-001"
}
'import requests
url = "https://api.openfiskal.com/v1/locations"
payload = {
"name": "Main Store",
"address": {
"line1": "Musterstr. 1",
"city": "Berlin",
"postal_code": "10115",
"country_code": "DEU",
"line2": "Apt 4"
},
"timezone": "Europe/Berlin",
"external_id": "loc-001"
}
headers = {
"X-OpenFiskal-Merchant": "<x-openfiskal-merchant>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-OpenFiskal-Merchant': '<x-openfiskal-merchant>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Main Store',
address: {
line1: 'Musterstr. 1',
city: 'Berlin',
postal_code: '10115',
country_code: 'DEU',
line2: 'Apt 4'
},
timezone: 'Europe/Berlin',
external_id: 'loc-001'
})
};
fetch('https://api.openfiskal.com/v1/locations', 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.openfiskal.com/v1/locations",
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' => 'Main Store',
'address' => [
'line1' => 'Musterstr. 1',
'city' => 'Berlin',
'postal_code' => '10115',
'country_code' => 'DEU',
'line2' => 'Apt 4'
],
'timezone' => 'Europe/Berlin',
'external_id' => 'loc-001'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-OpenFiskal-Merchant: <x-openfiskal-merchant>"
],
]);
$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.openfiskal.com/v1/locations"
payload := strings.NewReader("{\n \"name\": \"Main Store\",\n \"address\": {\n \"line1\": \"Musterstr. 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"country_code\": \"DEU\",\n \"line2\": \"Apt 4\"\n },\n \"timezone\": \"Europe/Berlin\",\n \"external_id\": \"loc-001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-OpenFiskal-Merchant", "<x-openfiskal-merchant>")
req.Header.Add("Authorization", "Bearer <token>")
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.openfiskal.com/v1/locations")
.header("X-OpenFiskal-Merchant", "<x-openfiskal-merchant>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Main Store\",\n \"address\": {\n \"line1\": \"Musterstr. 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"country_code\": \"DEU\",\n \"line2\": \"Apt 4\"\n },\n \"timezone\": \"Europe/Berlin\",\n \"external_id\": \"loc-001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openfiskal.com/v1/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-OpenFiskal-Merchant"] = '<x-openfiskal-merchant>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Main Store\",\n \"address\": {\n \"line1\": \"Musterstr. 1\",\n \"city\": \"Berlin\",\n \"postal_code\": \"10115\",\n \"country_code\": \"DEU\",\n \"line2\": \"Apt 4\"\n },\n \"timezone\": \"Europe/Berlin\",\n \"external_id\": \"loc-001\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"merchant_id": "<string>",
"name": "<string>",
"address": {
"line1": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "DEU",
"line2": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"timezone": "<string>"
}{
"code": "invalid_request",
"message": "The request body is malformed.",
"retryable": false
}{
"code": "unauthorized",
"message": "Authentication failed.",
"retryable": false
}{
"code": "forbidden",
"message": "The authenticated caller cannot access this resource.",
"retryable": false
}{
"code": "regime_validation_failed",
"message": "The payload violates regime-specific validation rules.",
"retryable": false
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Merchant identifier returned by the merchants resource.
Body
application/json
Was this page helpful?