> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://allianz.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://allianz.ferndocs.com/_mcp/server.

# Quickstart

#### Install the SDK

**`TypeScript`**

```bash title="TypeScript" for="typescript"
npm install allianz-partner-services
```

**`Python`**

```bash title="Python" for="python"
pip install allianz-partner-services
```

#### Create a client

The client defaults to the staging (UAT) gateway. See [Environments](/environments).

**`TypeScript`**

```typescript title="TypeScript"
import { AllianzPartnerServicesClient } from "allianz-partner-services";

const client = new AllianzPartnerServicesClient();
```

**`Python`**

```python title="Python"
from allianz_partner_services import AllianzPartnerServices

client = AllianzPartnerServices()
```

#### Get an auth token

Exchange your partner credentials for a token with [`POST /authtokens`](/api-reference/core/auth-tokens/create).

**`TypeScript`**

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

**`Python`**

```python title="Python"
auth = client.core.auth_tokens.create(
    user_name="YOUR_USERNAME",
    password="YOUR_PASSWORD",
)
```

#### Request a quote

Send the customers and the itinerary to [`POST /optimizations`](/api-reference/core/optimizations/create). The response contains the offers to display.

**`TypeScript`**

```typescript title="TypeScript"
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,
        },
    },
});
```

**`Python`**

```python title="Python"
import datetime

from allianz_partner_services.core import (
    Credentials,
    OptRequestCustomerAddress,
    OptRequestCustomersItem,
    OptRequestPartner,
    OptRequestTravel,
    OptRequestTravelDestination,
    OptRequestTravelOrigin,
)

quote = client.core.optimizations.create(
    fs_distributor_code="YOUR_DISTRIBUTOR_CODE",
    credentials=Credentials(user_name="YOUR_USERNAME", password="YOUR_PASSWORD"),
    partner=OptRequestPartner(distributor_code="YOUR_DISTRIBUTOR_CODE"),
    customer_address=OptRequestCustomerAddress(country="US", region="VA", postal_code="23294"),
    customers=[
        OptRequestCustomersItem(
            customer_type="Primary",
            sequence=0,
            first_name="John",
            last_name="Doe",
            birth_date=datetime.datetime(1980, 5, 10, tzinfo=datetime.timezone.utc),
        )
    ],
    travel=OptRequestTravel(
        origin=OptRequestTravelOrigin(code="RIC"),
        destination=OptRequestTravelDestination(code="LAX"),
        departure_date=datetime.datetime(2026, 12, 1, 9, tzinfo=datetime.timezone.utc),
        return_date=datetime.datetime(2026, 12, 8, 17, tzinfo=datetime.timezone.utc),
        total_cost=1200,
    ),
)
```

#### Report the decision

When the customer acts on the offer, send the decision to [`POST /decisions`](/api-reference/core/decisions/create).

**`TypeScript`**

```typescript title="TypeScript"
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",
        },
    ],
});
```

**`Python`**

```python title="Python"
from allianz_partner_services.core import Credentials
from allianz_partner_services.core.decisions import DecisionDetailsItem, DecisionPartner

client.core.decisions.create(
    credentials=Credentials(user_name="YOUR_USERNAME", password="YOUR_PASSWORD"),
    partner=DecisionPartner(distributor_code="YOUR_DISTRIBUTOR_CODE"),
    response_id="RESPONSE_ID",
    response_type="Purchased",
    details=[
        DecisionDetailsItem(
            response_offer_id="RESPONSE_OFFER_ID",
            response_quote_id="RESPONSE_QUOTE_ID",
            product_code="PRODUCT_CODE",
            response_type="Purchased",
        )
    ],
)
```

#### Submit the purchase

If the customer buys the insurance, send the purchase to [`POST /Purchase`](/api-reference/purchases/purchases/create).

**`TypeScript`**

```typescript title="TypeScript"
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 }],
                    },
                },
            ],
        },
    },
});
```

**`Python`**

```python title="Python"
from allianz_partner_services.purchases import (
    Auth,
    MainBody,
    ProductDetails,
    ProductDetailsProductItem,
    Purchase,
    Purchases,
)

client.purchases.purchases.create(
    partner=Auth(user_name="YOUR_USERNAME", password="YOUR_PASSWORD"),
    purchases_request=MainBody(
        accam="YOUR_ACCAM",
        transaction_id="ABC00000001",
        purchases=Purchases(
            purchase=[
                Purchase(
                    partner_booking_id="BOOKING_ID",
                    product_details=ProductDetails(
                        product=[ProductDetailsProductItem(sequence=0, quote_id=123456789, product_id=1004037)]
                    ),
                )
            ]
        ),
    ),
)
```