Quickstart guide

The following four requests enroll a single policyholder in the sandbox and retrieve the issued policy.

Sandbox

The sandbox can be accessed at the host URL https://platform-api.sandbox.safetywing.dev. It requires its own API key, which SafetyWing can issue on request by emailing [email protected]. Members enrolled in the sandbox also appear in the sandbox dashboard; logins can be provided by the SafetyWing team.

Once a sandbox API key has been issued, the following two commands set the host URL and API key.

export SW_BASE=https://platform-api.sandbox.safetywing.dev
export SW_KEY=<sandbox API key>

1. List available plans

curl -s "$SW_BASE/api/remote-health/v1/plans" -H "X-API-KEY: $SW_KEY"

The response lists every plan available to the company. For future steps, choose a plan and save its id. Note that a plan can cover an applicant only if:

  • one of its pricing bands includes the applicant's age
  • neither the applicant's citizenship nor country of residence is listed in excludedCountries

2. Submit an application bundle

curl -s -X POST "$SW_BASE/api/remote-health/v1/application-bundles" \
  -H "X-API-KEY: $SW_KEY" -H "Content-Type: application/json" \
  -d '{
    "applicants": [{
      "personDetailsType": "PolicyHolder",
      "externalId": "EMP-10042",
      "email": "[email protected]",
      "firstName": "John",
      "lastName": "Smith",
      "dateOfBirth": "1990-01-01",
      "gender": "MALE",
      "citizenship": "PT",
      "residentCountry": "PT",
      "address": {
        "line1": "999 Augusta Road",
        "city": "Porto",
        "postalCode": "4000-007",
        "country": "PT"
      },
      "applications": [{ "planId": <PLAN_ID>, "startDate": "<START_DATE>" }]
    }]
  }'

Before running the command, replace <PLAN_ID> with the plan id from step 1, and <START_DATE> with a date in YYYY-MM-DD format within the current company contract period. Start dates can only be on the 1st or 15th of the month.

The response contains the application bundle's id and, for the applicant, a userId that identifies the person permanently. Save both for the following steps.

3. Check activation

curl -s "$SW_BASE/api/remote-health/v1/application-bundles/<APPLICATION_BUNDLE_ID>" -H "X-API-KEY: $SW_KEY"

Replace <APPLICATION_BUNDLE_ID> with the id from step 2. The bundle's contractBundleId is missing until SafetyWing activates the application, after which it references the new contract bundle.

📘

Sandbox activation

Self-serve sandbox activation of members is not yet supported; to activate the application in sandbox, email [email protected] with the application bundle id. Coverage begins on the previously selected start date.

4. Retrieve the policy

curl -s "$SW_BASE/api/remote-health/v1/contract-bundles?userId=<USER_ID>" -H "X-API-KEY: $SW_KEY"

After SafetyWing activates the policy, replace <USER_ID> with the applicant's userId from step 2. The contract bundle then returns a contractHolders array (consisting of member details and a contract with policyId) along with contract details, including startDate, endDate, and costs.

The policyholder is now enrolled in sandbox coverage.


What’s Next

Did this page help you?