Skip to content

api passes create

Matteo Gavagnin edited this page Nov 1, 2012 · 1 revision

Create Pass

Create a new Pass from a pre-defined Template with the given keys/values pairs. In the Pass' json you can use these shortcuts:

  • If you need to set the value of a key just pass "gate":"53"
  • If you need to set the value and label of a key pass "gate":{"value":"53","label":"GATE"}

POST /api/v1/templates/:template_id/passes


Param name Required Description
template_id Template ID
api_token Your Passdock API key
pass A JSON dictionary containing the pass keys and values
pass[serial_number] The serial number for the Pass, must be unique and cannot be changed
pass[KEY] The desired keys that are present in the template and left empty.
pass[KEY][label] The label for the field, usually placed above the value.
pass[KEY][value] The value of the field, usually placed below the label.
pass[KEY][message] The change message that will be shown in the lock screen and as notification when the value for the field is changed remotely.
pass[bar] An hash containing the Bar Section informations
pass[bar][message] The message to be put in the 2D code
pass[bar][altText] The alternative text that will be put below the bar code.
pass[relevance] An hash containing the relevance informations like date, time and positions.
pass[relevance][locations] Array of locations where the pass will appear on the lockscreen
pass[relevance][locations][latitude] Latitude
pass[relevance][locations][longitude] Longitude
pass[relevance][locations][altitude] Altitude
pass[relevance][locations][relevantText] Text that will appear on the lockscreen when the place is reached.
pass[relevance][relevantDate] Date and Time when the pass will appear on the lockscreen. Use ISO8601 format.
debug You get in response a JSON with the created object.
errors If an error occurs you get the messages and not only the code.

Supported Formats


Success Response:

  • Code: 200
    Content: Good Request


  • Code: 200
    Content: Good Request with Debug Enabled


      "auxiliary": [
          "changeMessage": "Departure time changed to %@",
          "dateStyle": "PKDateStyleMedium",
          "key": "departure",
          "label": "DEPARTURE",
          "timeStyle": "PKTimeStyleMedium",
          "value": "2012-12-18T14:34:10-02:00"
      "back": [
          "changeMessage": "",
          "key": "passport",
          "label": "PASSPORT",
          "value": ""
      "bar": {
        "format": "PKBarcodeFormatQR",
        "message": "",
        "messageEncoding": "iso-8859-1"
      "created_at": "2012-10-18T09:40:27Z",
      "custom": [
          "transitType": "PKTransitTypeAir"
      "download_url": "/passes/202",
      "family_id": 106,
      "header": [
          "changeMessage": "Gate changed to %@",
          "key": "gate",
          "label": "GATE",
          "value": "53"
      "id": 202,
      "primary": [
          "changeMessage": "Departure changed in %@",
          "key": "from",
          "label": "FROM",
          "value": ""
          "changeMessage": "Destination changed to %@",
          "key": "to",
          "label": "TO",
          "value": ""
      "relevance": {
      "secondary": [
          "changeMessage": "Passenger name changed to %@",
          "key": "name",
          "label": "NAME",
          "value": ""
      "serial_number": "1234567",
      "updated_at": "2012-10-18T09:40:27Z",
      "visual": {
        "backgroundColor": "rgb(237,184,61)",
        "foregroundColor": "rgb(255,255,255)",
        "labelColor": "",
        "logoText": "Passdock Airways"
      "web_token": "36eb5647504035593388c01189089c0512561268"

Error Response:

  • Code: 400
    Content: Bad Request


  • Code: 401
    Content: Unauthorized


  • Code: 404
    Content: Pass Not Found


  • Code: 420
    Content: Key Not Found In The Template

Sample Calls:

curl -i -d 'pass={"serial_number":"1234567", "gate":"53", "departure":"2012-12-18T14:34:10-02:00"}'
curl -i -d 'debug=true&pass={"serial_number":"4567891", "bar":{"message":"QRRSNDKAIUDS923", "altText":"QRRSNDKAIUDS923"}, "gate":{"value":"53"},"departure":"2012-11-14T08:12:19-08:00"}'
curl -i -d 'debug=true&pass={"serial_number":"7891234", "relevance":{"locations":[{"latitude":12.122342, "longitude":64.123353}]}, "gate":{"value":"98"},"departure":"2012-11-14T08:12:19-08:00"}'
Something went wrong with that request. Please try again.