Sherpa - Visa and Travel Restrictions API

Sherpa Developer Hub

Welcome to the sherpaΒ° developer hub. We offer a suite of solutions that guides travellers from planning to a safe return home. Take a look at the integration guides, specific use cases and an interactive API Reference. Ready? Let's go.

Guides    API Reference

Basic Discovery Placement

πŸ“˜

Always include a placement

This will help make analytics reports clear. It will allow our team to allocate resources more effectively.

const elementConfig = {
  placement: "discovery"
}
$sherpa.V2.createElement('trip',elementConfig ).mount('#sherpa-widget')

Manage My Booking - Return Trip

The following configuration shows travel restrictions for a return trip from USA to Mexico.

const elementConfig = {
  placement: "mmb",
  segments: [{
      segmentType: 'OUTBOUND',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      departureDate: '2021-02-22',
            departureTime: '12:59:00',
      arrivalDate: '2021-02-22',
      arrivalTime: '12:59:00',
    },
    {
      segmentType: 'RETURN',
      origin: {
        countryCode: 'MEX',
      },
      destination: {
        countryCode: 'USA',
      },
      departureDate: '2021-03-22',
      // departureTime: '12:59:00',
      arrivalDate: '2021-03-22',
      // arrivalTime: '12:59:00',
    },
  ],
}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Manage My Booking - Return Trip via connection

The following configuration shows travel restrictions for a return trip from Mexico to Canada via a connection in USA.

Manage My Booking - Return Trip and outbound via connections

The following configuration shows travel restrictions via connection outbound and return. The use case takes into account origin as Germany (DEU) to Mexico via USA, while the return leg will be Mexico to Germany (DEU) via Canada.

const elementConfig = {
  placement: "mmb",
  segments: [{
      segmentType: 'OUTBOUND',
      segmentSubType: 'TRANSIT',
      origin: {
        countryCode: 'DEU',
      },
      destination: {
        countryCode: 'USA',
      },
      travelMode: 'AIR',
      departureDate: '2021-02-22',
      // departureTime: '12:59:00',
      arrivalDate: '2021-02-22',
      // arrivalTime: '12:59:00',
    },
    {
      segmentType: 'OUTBOUND',      
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
    },
    
    {
      segmentType: 'RETURN',
      segmentSubType: 'TRANSIT',
      origin: {
        countryCode: 'MEX',
      },
      destination: {
        countryCode: 'CAN',
      },
      travelMode: 'AIR',
      departureDate: '2021-03-22',
      // departureTime: '12:59:00',
      arrivalDate: '2021-03-22',
      // arrivalTime: '12:59:00',
    },
    {
      segmentType: 'RETURN',      
      origin: {
        countryCode: 'CAN',
      },
      destination: {
        countryCode: 'DEU',
      },
    },
    
  ],

}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Manage My Booking - display an extended segment

The following configuration highlights the ability show an extended segment. Consider a trip between USA to Mexico with return from Mexico to USA. The below codes highlights the USA to Mexico leg segment

const elementConfig = {
  placement: 'mmb',
  selected: {
    segment: 1,
    extended: true
  },
  segments: [{
      segmentType: 'OUTBOUND',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-02-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-02-22',
      arrivalTime: '12:59:00',
    },

    {
      segmentType: 'RETURN',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-03-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-03-22',
      arrivalTime: '12:59:00',
    },
  ],

}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Manage My Booking - hide segments

The following configuration allows you to hide the segments taking a trip that goes from USA to Mexico and has a return leg from Mexico to USA.

const elementConfig = {
  placement: 'mmb',
  selected: {
    segment: 1,
  },
  features: {
    showSegments: false,
  },
  segments: [{
      segmentType: 'OUTBOUND',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-02-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-02-22',
      arrivalTime: '12:59:00',
    },

    {
      segmentType: 'RETURN',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-03-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-03-22',
      arrivalTime: '12:59:00',
    },
  ],

}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Manage My Booking - hide title

The following configuration allows you to hide the title taking a trip that goes from USA to Mexico and has a return leg from Mexico to USA.

const elementConfig = {
  placement: 'mmb',
  features: {
    showTitle: false
  },
  segments: [{
      segmentType: 'OUTBOUND',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-02-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-02-22',
      arrivalTime: '12:59:00',
    },

    {
      segmentType: 'RETURN',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-03-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-03-22',
      arrivalTime: '12:59:00',
    },
  ],

}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Manage My Booking - hide 'View all restrictions'

The following configuration allows you to hide 'View all restrictions' link with the below example representing taking a trip that goes from USA to Mexico and has a return leg from Mexico to USA.

const elementConfig = {
  placement: 'mmb',
  selected: {
    segment: 1,
  },
  features: {
    showViewAllLink: false
  },
  segments: [{
      segmentType: 'OUTBOUND',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-02-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-02-22',
      arrivalTime: '12:59:00',
    },

    {
      segmentType: 'RETURN',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-03-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-03-22',
      arrivalTime: '12:59:00',
    },
  ],

}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Better reporting

The following configuration allows for better reporting through analytics by passing utm tags

const elementConfig = {
  placement: 'mmb',
  queryParams: {
    utm_medium: 'medium',
    utm_source: 'source',
    utm_campaign: 'campaign'
  },
  segments: [{
      segmentType: 'OUTBOUND',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-02-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-02-22',
      arrivalTime: '12:59:00',
    },

    {
      segmentType: 'RETURN',
      origin: {
        countryCode: 'USA',
      },
      destination: {
        countryCode: 'MEX',
      },
      travelMode: 'AIR',
      departureDate: '2021-03-22',
      departureTime: '12:59:00',
      arrivalDate: '2021-03-22',
      arrivalTime: '12:59:00',
    },
  ],

}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Updated 3 months ago


Examples


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.