Skip to main content
POST
/
quotes
Create a price-locked quote
curl --request POST \
  --url https://api.safarapi.com/api/partner/v1/quotes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --header 'X-Signature: <x-signature>' \
  --header 'X-Timestamp: <x-timestamp>' \
  --data '
{
  "adventure_slug": "marrakech-3-jours-desert-sandbox",
  "rate_pack_id": "4a700002-0000-4000-8000-0000000000f2",
  "start_date": "2026-07-12",
  "rooms": [
    {
      "adults": 2,
      "children": [
        {
          "age": 8
        },
        {
          "age": 12
        }
      ]
    }
  ]
}
'
import requests

url = "https://api.safarapi.com/api/partner/v1/quotes"

payload = {
    "adventure_slug": "marrakech-3-jours-desert-sandbox",
    "rate_pack_id": "4a700002-0000-4000-8000-0000000000f2",
    "start_date": "2026-07-12",
    "rooms": [
        {
            "adults": 2,
            "children": [{ "age": 8 }, { "age": 12 }]
        }
    ]
}
headers = {
    "Idempotency-Key": "<idempotency-key>",
    "X-Timestamp": "<x-timestamp>",
    "X-Signature": "<x-signature>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': '<idempotency-key>',
    'X-Timestamp': '<x-timestamp>',
    'X-Signature': '<x-signature>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    adventure_slug: 'marrakech-3-jours-desert-sandbox',
    rate_pack_id: '4a700002-0000-4000-8000-0000000000f2',
    start_date: '2026-07-12',
    rooms: [{adults: 2, children: [{age: 8}, {age: 12}]}]
  })
};

fetch('https://api.safarapi.com/api/partner/v1/quotes', 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.safarapi.com/api/partner/v1/quotes",
  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([
    'adventure_slug' => 'marrakech-3-jours-desert-sandbox',
    'rate_pack_id' => '4a700002-0000-4000-8000-0000000000f2',
    'start_date' => '2026-07-12',
    'rooms' => [
        [
                'adults' => 2,
                'children' => [
                                [
                                                                'age' => 8
                                ],
                                [
                                                                'age' => 12
                                ]
                ]
        ]
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "Idempotency-Key: <idempotency-key>",
    "X-Signature: <x-signature>",
    "X-Timestamp: <x-timestamp>"
  ],
]);

$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.safarapi.com/api/partner/v1/quotes"

	payload := strings.NewReader("{\n  \"adventure_slug\": \"marrakech-3-jours-desert-sandbox\",\n  \"rate_pack_id\": \"4a700002-0000-4000-8000-0000000000f2\",\n  \"start_date\": \"2026-07-12\",\n  \"rooms\": [\n    {\n      \"adults\": 2,\n      \"children\": [\n        {\n          \"age\": 8\n        },\n        {\n          \"age\": 12\n        }\n      ]\n    }\n  ]\n}")

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

	req.Header.Add("Idempotency-Key", "<idempotency-key>")
	req.Header.Add("X-Timestamp", "<x-timestamp>")
	req.Header.Add("X-Signature", "<x-signature>")
	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.safarapi.com/api/partner/v1/quotes")
  .header("Idempotency-Key", "<idempotency-key>")
  .header("X-Timestamp", "<x-timestamp>")
  .header("X-Signature", "<x-signature>")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"adventure_slug\": \"marrakech-3-jours-desert-sandbox\",\n  \"rate_pack_id\": \"4a700002-0000-4000-8000-0000000000f2\",\n  \"start_date\": \"2026-07-12\",\n  \"rooms\": [\n    {\n      \"adults\": 2,\n      \"children\": [\n        {\n          \"age\": 8\n        },\n        {\n          \"age\": 12\n        }\n      ]\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.safarapi.com/api/partner/v1/quotes")

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

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["X-Timestamp"] = '<x-timestamp>'
request["X-Signature"] = '<x-signature>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"adventure_slug\": \"marrakech-3-jours-desert-sandbox\",\n  \"rate_pack_id\": \"4a700002-0000-4000-8000-0000000000f2\",\n  \"start_date\": \"2026-07-12\",\n  \"rooms\": [\n    {\n      \"adults\": 2,\n      \"children\": [\n        {\n          \"age\": 8\n        },\n        {\n          \"age\": 12\n        }\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
{ "id": "9b2e4c7a-1f3d-4a8b-9c0e-2d5f6a7b8c90", "adventure_slug": "marrakech-3-jours-desert-sandbox", "rate_pack_id": "4a700002-0000-4000-8000-0000000000f2", "start_date": "2026-07-12", "start_time": null, "rooms": [ { "adults": 2, "children": [ { "age": 8 }, { "age": 12 } ] } ], "pricing": { "b2c_price": { "amount": "6000.00", "currency": "MAD" }, "customer_price": { "amount": "6000.00", "currency": "MAD" }, "amount_due_to_safariat": { "amount": "5900.00", "currency": "MAD" }, "awb_commission_share": { "amount": "100.00", "currency": "MAD" }, "sandbox_surcharge": { "amount": "0.00", "currency": "MAD" }, "indicative": false }, "breakdown": { "adults": { "count": 2, "unit_price": { "amount": "2400.00", "currency": "MAD" }, "subtotal": { "amount": "4800.00", "currency": "MAD" } }, "children": { "count": 2, "subtotal": { "amount": "600.00", "currency": "MAD" } }, "extra_beds": { "count": 0, "unit_price": { "amount": "0.00", "currency": "MAD" }, "subtotal": { "amount": "0.00", "currency": "MAD" } }, "rooms_total": { "amount": "5400.00", "currency": "MAD" } }, "expires_at": "2026-07-12T10:30:00Z" }

Authorizations

Authorization
string
header
default:sk_test_DEMO0000_replace_with_your_sandbox_key
required

API key authentication. Issued by the Safariat admin or via the partner portal. The secret is shown only once at generation.

Production sk_live_* keys must additionally sign every write request (POST/PUT/DELETE) with the X-Timestamp and X-Signature headers. Sandbox sk_test_* keys are exempt from request signing: X-Signature and X-Timestamp are not required for writes in the sandbox (so the developer-portal "Try it" playground works end to end). The Idempotency-Key header remains required on writes in both environments.

Headers

Idempotency-Key
string
required

Opaque, client-generated string unique per logical operation (a UUID v4 is recommended but any non-blank value up to 255 chars is accepted). Same key + same body = the cached response is returned with the Idempotent-Replayed: true header. Same key + different body = 409 Conflict. Retained for 24 h.

Maximum string length: 255
X-Timestamp
integer<int64>
required

Unix timestamp in seconds at the time the request is issued. Validity window ±5 minutes — beyond that the request is rejected. Required for production sk_live_* keys only; not required for sandbox sk_test_* keys.

X-Signature
string
required

hex(HMAC_SHA256(secret, "{X-Timestamp}\n{METHOD}\n{path}\n{body}")). The path includes the query string. The body is the exact JSON representation sent — any reformatting invalidates the signature. Required for production sk_live_* keys only; not required for sandbox sk_test_* keys.

Pattern: ^[a-f0-9]{64}$

Body

application/json
adventure_slug
string
required
Pattern: ^[a-z0-9-]+$
rate_pack_id
string<uuid>
required
start_date
string<date>
required
rooms
object[]
required
Required array length: 1 - 10 elements
start_time
string | null

Required for EXPERIENCE, ignored for TRIP.

Pattern: ^[0-2][0-9]:[0-5][0-9]$

Response

Quote created

id
string<uuid>
required
pricing
object
required

Revenue breakdown (locked price; indicative = false, sandbox_surcharge = 0). pricing.amount_due_to_safariat is the amount-match anchor for booking creation.

breakdown
object
required
expires_at
string<date-time>
required

30-minute TTL after creation.

adventure_slug
string
rate_pack_id
string<uuid>
start_date
string<date>
start_time
string | null
rooms
object[]