Skip to navigation

Quickstart

Request a quote, then report the customer's decision
1

Install the SDK

npm install allianz-partner-services
2

Create a client

The client defaults to the staging (UAT) gateway. See Environments.

import { AllianzPartnerServicesClient } from "allianz-partner-services";
const client = new AllianzPartnerServicesClient();
3

Get an auth token

Exchange your partner credentials for a token with POST /authtokens.

const auth = await client.core.authTokens.create({
userName: "YOUR_USERNAME",
password: "YOUR_PASSWORD",
});
4

Request a quote

Send the customers and the itinerary to POST /optimizations. The response contains the offers to display.

const quote = await client.core.optimizations.create({
"FS-Distributor-Code": "YOUR_DISTRIBUTOR_CODE",
body: {
credentials: { userName: "YOUR_USERNAME", password: "YOUR_PASSWORD" },
partner: { distributorCode: "YOUR_DISTRIBUTOR_CODE" },
customerAddress: { country: "US", region: "VA", postalCode: "23294" },
customers: [
{
customerType: "Primary",
sequence: 0,
firstName: "John",
lastName: "Doe",
birthDate: "1980-05-10T00:00:00Z",
},
],
travel: {
origin: { code: "RIC" },
destination: { code: "LAX" },
departureDate: "2026-12-01T09:00:00Z",
returnDate: "2026-12-08T17:00:00Z",
totalCost: 1200,
},
},
});
5

Report the decision

When the customer acts on the offer, send the decision to POST /decisions.

await client.core.decisions.create({
credentials: { userName: "YOUR_USERNAME", password: "YOUR_PASSWORD" },
partner: { distributorCode: "YOUR_DISTRIBUTOR_CODE" },
responseId: "RESPONSE_ID",
responseType: "Purchased",
details: [
{
responseOfferId: "RESPONSE_OFFER_ID",
responseQuoteId: "RESPONSE_QUOTE_ID",
productCode: "PRODUCT_CODE",
responseType: "Purchased",
},
],
});
6

Submit the purchase

If the customer buys the insurance, send the purchase to POST /Purchase.

await client.purchases.purchases.create({
Partner: { UserName: "YOUR_USERNAME", Password: "YOUR_PASSWORD" },
PurchasesRequest: {
Accam: "YOUR_ACCAM",
TransactionID: "ABC00000001",
Purchases: {
Purchase: [
{
PartnerBookingID: "BOOKING_ID",
ProductDetails: {
Product: [{ Sequence: 0, QuoteID: 123456789, ProductID: 1004037 }],
},
},
],
},
},
});