GET /api/v1/templates
Get All Templates

Returns a JSON of the Templates owned by the user.

Supported Formats

json

Success Response:

200 Good Request
                  [
      {
        "auxiliary": [
          {
            "changeMessage": "Departure time changed to %@",
            "dateStyle": "PKDateStyleMedium",
            "key": "departure",
            "label": "DEPARTURE",
            "timeStyle": "PKDateStyleMedium",
            "value": ""
          }
        ],
        "back": [
          {
            "changeMessage": "",
            "key": "passport",
            "label": "PASSPORT",
            "value": ""
          }
        ],
        "bar": {
          "altText": "",
          "format": "PKBarcodeFormatQR",
          "message": "",
          "messageEncoding": "iso-8859-1"
        },
        "created_at": "2012-10-18T09:03:46Z",
        "custom": [
          {
            "transitType": "PKTransitTypeAir"
          }
        ],
        "header": [
          {
            "changeMessage": "Gate changed to %@",
            "key": "gate",
            "label": "GATE",
            "value": ""
          }
        ],
        "id": 106,
        "primary": [
          {
            "changeMessage": "Departure changed in %@",
            "key": "from",
            "label": "FROM",
            "value": ""
          },
          {
            "changeMessage": "Destination changed to %@",
            "key": "to",
            "label": "TO",
            "value": ""
          }
        ],
        "relevance": {
          "relevantDate": ""
        },
        "secondary": [
          {
            "changeMessage": "Passenger name changed to %@",
            "key": "name",
            "label": "NAME",
            "value": ""
          }
        ],
        "title": "Passdock Airways",
        "updated_at": "2012-10-18T09:13:47Z",
        "visual": {
          "backgroundColor": "rgb(237,184,61)",
          "foregroundColor": "rgb(255,255,255)",
          "labelColor": "",
          "logoText": "Passdock Airways"
        }
      }
  ]
              

Errors

400 Bad Request
401 Unauthorized

Examples

curl -i https://api.passdock.com/api/v1/templates?api_token=75778a65dfdae310a107d2ef0bbd3780

Params

Param name Description
api_token
required

Your Passdock API key


Value: Must be String
page
optional

Page of results, currently the param is optional, but will be required soon. Each page contains 50 Templates ordered date (more recents first)


Value: Must be Fixnum

GET /api/v1/templates/:id
Show Template

Returns a JSON of the Template

Supported Formats

json

Success Response:

200 Good Request
                  {
      "auxiliary": [
        {
          "changeMessage": "Departure time changed to %@",
          "dateStyle": "PKDateStyleMedium",
          "key": "departure",
          "label": "DEPARTURE",
          "timeStyle": "PKDateStyleMedium",
          "value": ""
        }
      ],
      "back": [
        {
          "changeMessage": "",
          "key": "passport",
          "label": "PASSPORT",
          "value": ""
        }
      ],
      "bar": {
        "altText": "",
        "format": "PKBarcodeFormatQR",
        "message": "",
        "messageEncoding": "iso-8859-1"
      },
      "created_at": "2012-10-18T09:03:46Z",
      "custom": [
        {
          "transitType": "PKTransitTypeAir"
        }
      ],
      "header": [
        {
          "changeMessage": "Gate changed to %@",
          "key": "gate",
          "label": "GATE",
          "value": ""
        }
      ],
      "id": 106,
      "primary": [
        {
          "changeMessage": "Departure changed in %@",
          "key": "from",
          "label": "FROM",
          "value": ""
        },
        {
          "changeMessage": "Destination changed to %@",
          "key": "to",
          "label": "TO",
          "value": ""
        }
      ],
      "relevance": {
        "relevantDate": ""
      },
      "secondary": [
        {
          "changeMessage": "Passenger name changed to %@",
          "key": "name",
          "label": "NAME",
          "value": ""
        }
      ],
      "title": "Passdock Airways",
      "updated_at": "2012-10-18T09:13:47Z",
      "visual": {
        "backgroundColor": "rgb(237,184,61)",
        "foregroundColor": "rgb(255,255,255)",
        "labelColor": "",
        "logoText": "Passdock Airways"
      }
    }
              

Errors

401 Unauthorized
404 Not Found

Examples

curl -i https://api.passdock.com/api/v1/templates/106?api_token=75778a65dfdae310a107d2ef0bbd3780

Params

Param name Description
id
required

Template ID


Value: Must be Fixnum
api_token
required

Your Passdock API key


Value: Must be String

POST /api/v1/templates
Create Template

Create a new Template for a desired category.

Supported Formats

json

Success Response:

201 Created
                  {"id":12}
              
OR 201 Created with Debug Enabled
                  {
      "add_serial_to_back": true,
      "auxiliary": null,
      "back": null,
      "bar": {
      },
      "custom": null,
      "description": null,
      "format_version": null,
      "header": [
        {
          "changeMessage": "Gate changed",
          "key": "gate",
          "label": "GATE",
          "value": ""
        }
      ],
      "kind_id": 5,
      "organization_name": "Passdock Airlines",
      "pass_type_identifier": "pass.passdock.sample1",
      "primary": [
      ],
      "relevance": {
        "relevantDate": ""
      },
      "secondary": null,
      "team_identifier": "6J39RL8VD6",
      "title": "Passdock Airways",
      "visual": {
        "backgroundColor": "rgb(32,87,132)",
        "foregroundColor": "rgb(255,255,255)",
        "labelColor": " "
      }
    }
              

Errors

400 Bad Request
401 Unauthorized

Examples

curl -i -d 'debug=true&errors=true&family={"title":"Passdock Airways","header":[{"key":"gate","label":"GATE","value":"","changeMessage":"Gate changed"}],"primary":[],"custom":null,"visual":{"backgroundColor":"rgb(32,87,132)","foregroundColor":"rgb(255,255,255)","labelColor":" "},"relevance":{"relevantDate":""},"bar":{}, "organization_name":"Passdock Airlines","kind_id":5}&certificate={"data":"THE_CERTIFICATE_ATTRIBUTE_BAG"}&icon={"filename":"test.png","data":"THE_BASE_64_ENCODED_IMAGE"}' https://api.passdock.com/api/v1/templates?api_token=11edb4f913d11cfa7ce8b61546948a3f

Params

Param name Description
api_token
required

Your Passdock API key


Value: Must be String
title
required

The title of the Template, must be unique between your templates


Value: Must be String
description
required

Brief description of the pass, used by the iOS accessibility technologies. Don't try to include all of the data on the pass in its description, just include enough detail to distinguish passes of the same type.


Value: Must be String
kind_id
required

The category of the Template: 1 for Boarding Pass, 2 for Event Ticket with background and thumbnail, 3 for Coupon, 4 for Store Card, 5 Generic, 6 for Event Ticket with strip.


Value: Must be Integer
certificate
required

Certificate to digitally sign each pass and send push notifications.


Value: Must be a Hash
certificate[data]
required

The certificate blob in format.


Value: Must be String
icon
required

Icon for the Template, appears when the pass is shown in the lockscreen and as mail attachment.


Value: Must be a Hash
icon[filename]
required

Name of the file.


Value: Must be String
icon[data]
required

Content of the image in base64 format.


Value: Must be String
logo
optional

Logo for the Template.


Value: Must be a Hash
logo[filename]
required

Name of the file.


Value: Must be String
logo[data]
required

Content of the image in base64 format.


Value: Must be String
background
optional

Background image for the Template, can be set only if the category is Event Ticket (kind_id = 2).


Value: Must be a Hash
background[filename]
required

Name of the file.


Value: Must be String
background[data]
required

Content of the image in base64 format.


Value: Must be String
thumbnail
optional

Thumbnail image for the Template, can be set only if the category is Event Ticket and Generic (kind_id = 2 or 5).


Value: Must be a Hash
thumbnail[filename]
required

Name of the file.


Value: Must be String
thumbnail[data]
required

Content of the image in base64 format.


Value: Must be String
strip
optional

Strip image for the Template, can be set only if the category is Event Ticket, Coupon and Store Card (kind_id = 3, 4 or 6).


Value: Must be a Hash
strip[filename]
required

Name of the file.


Value: Must be String
strip[data]
required

Content of the image in base64 format.


Value: Must be String
family
required

A JSON dictionary containing the template definition


Value: Must be a Hash
family[header]
optional

An array of fields for the header section, usually of just one element


Value: Must be a Hash
family[header][field]
optional

An Hash for each field


Value: Must be a Hash
family[header][field][key]
required

The key for the field, invisible on the pass. Is used to create the passes via API as field identifier.


Value: Must be String
family[header][field][label]
optional

The label for the field, usually placed above the value.


Value: Must be String
family[header][field][value]
optional

The value of the field, usually placed below the label.


Value: Must be String
family[header][field][changeMessage]
optional

The change message that will be shown in the lock screen and as notification when the value for the field is changed remotely.


Value: Must be String
family[header][field][textAlignment]
optional

Alignment for the field's contents. Must be one of the following values: PKTextAlignmentLeft, PKTextAlignmentCenter, PKTextAlignmentRight, PKTextAlignmentNatural. This key is not allowed for primary fields.


Value: Must be String
family[header][field][dateStyle]
optional

Style of date to display. Must be one of the following values: PKDateStyleNone, PKDateStyleShort, PKDateStyleMedium, PKDateStyleLong, PKDateStyleFull.


Value: Must be String
family[header][field][timeStyle]
optional

Style of time to display. Must be one of the following values: PKDateStyleNone, PKDateStyleShort, PKDateStyleMedium, PKDateStyleLong, PKDateStyleFull.


Value: Must be String
family[header][field][isRelative]
optional

If true, the label\'s value is displayed as a relative date; otherwise, it is displayed as an absolute date. The default value is false.


Value: Must be one of: true, false.
family[header][field][currencyCode]
optional

ISO 4217 currency code for the field's value.


Value: Must be String
family[header][field][numberStyle]
optional

Style of number to display. Must be one of the following values: PKNumberStyleDecimal, PKNumberStylePercent, PKNumberStyleScientific, PKNumberStyleSpellOut.


Value: Must be String
family[visual]
required

Parameters related to the appearance of the pass


Value: Must be a Hash
family[visual][backgroundColor]
required

Background color of the pass, specified as an CSS-style RGB triple. For example, rgb(23, 187, 82).


Value: Must be String
family[visual][foregroundColor]
required

Foreground color of the pass, specified as a CSS-style RGB triple. For example, rgb(100, 10, 110).


Value: Must be String
family[visual][labelColor]
optional

Color of the label text, specified as a CSS-style RGB triple. For example, rgb(255, 255, 255). If omitted, the label color is determined automatically.


Value: Must be String
family[visual][logoText]
optional

Text displayed next to the logo on the pass.


Value: Must be String
family[visual][suppressStripShine]
optional

If true and a strip image is present, the strip image is displayed without a shine effect. The default value is false.


Value: Must be String
family[primary]
optional

An array of fields for the primary section


Value: Must be a Hash
family[primary][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[secondary]
optional

An array of fields for the secondary section


Value: Must be a Hash
family[secondary][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[auxiliary]
optional

An array of fields for the auxiliary section


Value: Must be a Hash
family[auxiliary][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[back]
optional

An array of fields for the back section


Value: Must be a Hash
family[back][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[custom]
required

Value: Must be a Hash
family[custom][transitType]
required

Required for boarding passes; otherwise not allowed. Type of transit. Must be one of the following values: PKTransitTypeAir, PKTransitTypeBoat, PKTransitTypeBus, PKTransitTypeGeneric, PKTransitTypeTrain.


Value: Must be String
family[bar]
optional

An hash containing the Bar Section informations


Value: Must be a Hash
family[bar][message]
optional

The message to be put in the 2D code


Value: Must be String
family[bar][format]
required

Barcode format. Must be one of the following values: PKBarcodeFormatQR, PKBarcodeFormatPDF417, PKBarcodeFormatAztec.


Value: Must be String
family[bar][altText]
optional

The alternative text that will be put below the bar code.


Value: Must be String
family[bar][messageEncoding]
required

Text encoding that is used to convert the message from the string representation to a data representation to render the barcode. The value is typically iso-8859-1, but you may use another encoding that is supported by your barcode scanning infrastructure.


Value: Must be String
family[relevance]
optional

An hash containing the relevance informations like date, time and positions.


Value: Must be a Hash
family[relevance][locations]
optional

Array of locations where the pass will appear on the lockscreen


Value: Must be a Hash
family[relevance][locations][latitude]
required

Latitude


Value: Must be String
family[relevance][locations][longitude]
required

Longitude


Value: Must be String
family[relevance][locations][altitude]
optional

Altitude


Value: Must be String
family[relevance][locations][relevantText]
optional

Text that will appear on the lockscreen when the place is reached.


Value: Must be String
family[relevance][relevantDate]
optional

Date and Time when the pass will appear on the lockscreen. Use ISO8601 format.


Value: Must be String
limit_to_1_device
optional

Limit to 1 device per pass


Value: Must be one of: 0, 1.
debug
optional

You get in response a JSON with the created object.


Value: Must be one of: true, false.
errors
optional

If an error occurs you get the messages and not only the code.


Value: Must be one of: true, false.

PUT /api/v1/templates/:template_id
Update Template

Update a desired Template.

Supported Formats

json

Success Response:

200 Good Request
                  {"id":12}
              
OR 200 Updated with Debug Enabled
                  {
      "add_serial_to_back": true,
      "auxiliary": null,
      "back": null,
      "bar": {
      },
      "custom": null,
      "description": null,
      "format_version": null,
      "header": [
        {
          "changeMessage": "Gate changed",
          "key": "gate",
          "label": "GATE",
          "value": ""
        }
      ],
      "organization_name": "Passdock Airlines",
      "pass_type_identifier": "pass.passdock.sample1",
      "primary": [
      ],
      "relevance": {
        "relevantDate": ""
      },
      "secondary": null,
      "team_identifier": "6J39RL8VD6",
      "title": "Passdock Airways",
      "visual": {
        "backgroundColor": "rgb(32,87,132)",
        "foregroundColor": "rgb(255,255,255)",
        "labelColor": " "
      }
    }
              

Errors

400 Bad Request
401 Unauthorized

Params

Param name Description
api_token
required

Your Passdock API key


Value: Must be String
title
optional

The title of the Template, must be unique between your templates


Value: Must be String
description
optional

Brief description of the pass, used by the iOS accessibility technologies. Don't try to include all of the data on the pass in its description, just include enough detail to distinguish passes of the same type.


Value: Must be String
certificate
optional

Certificate to digitally sign each pass and send push notifications.


Value: Must be a Hash
certificate[data]
required

The certificate blob in format.


Value: Must be String
icon
optional

Icon for the Template, appears when the pass is shown in the lockscreen and as mail attachment.


Value: Must be a Hash
icon[filename]
required

Name of the file.


Value: Must be String
icon[data]
required

Content of the image in base64 format.


Value: Must be String
logo
optional

Logo for the Template.


Value: Must be a Hash
logo[filename]
required

Name of the file.


Value: Must be String
logo[data]
required

Content of the image in base64 format.


Value: Must be String
background
optional

Background image for the Template, can be set only if the category is Event Ticket (kind_id = 2).


Value: Must be a Hash
background[filename]
required

Name of the file.


Value: Must be String
background[data]
required

Content of the image in base64 format.


Value: Must be String
thumbnail
optional

Thumbnail image for the Template, can be set only if the category is Event Ticket and Generic (kind_id = 2 or 5).


Value: Must be a Hash
thumbnail[filename]
required

Name of the file.


Value: Must be String
thumbnail[data]
required

Content of the image in base64 format.


Value: Must be String
strip
optional

Strip image for the Template, can be set only if the category is Event Ticket, Coupon and Store Card (kind_id = 3, 4 or 6).


Value: Must be a Hash
strip[filename]
required

Name of the file.


Value: Must be String
strip[data]
required

Content of the image in base64 format.


Value: Must be String
family
required

A JSON dictionary containing the template definition


Value: Must be a Hash
family[header]
optional

An array of fields for the header section, usually of just one element


Value: Must be a Hash
family[header][field]
optional

An Hash for each field


Value: Must be a Hash
family[header][field][key]
required

The key for the field, invisible on the pass. Is used to create the passes via API as field identifier.


Value: Must be String
family[header][field][label]
optional

The label for the field, usually placed above the value.


Value: Must be String
family[header][field][value]
optional

The value of the field, usually placed below the label.


Value: Must be String
family[header][field][changeMessage]
optional

The change message that will be shown in the lock screen and as notification when the value for the field is changed remotely.


Value: Must be String
family[header][field][textAlignment]
optional

Alignment for the field's contents. Must be one of the following values: PKTextAlignmentLeft, PKTextAlignmentCenter, PKTextAlignmentRight, PKTextAlignmentNatural. This key is not allowed for primary fields.


Value: Must be String
family[header][field][dateStyle]
optional

Style of date to display. Must be one of the following values: PKDateStyleNone, PKDateStyleShort, PKDateStyleMedium, PKDateStyleLong, PKDateStyleFull.


Value: Must be String
family[header][field][timeStyle]
optional

Style of time to display. Must be one of the following values: PKDateStyleNone, PKDateStyleShort, PKDateStyleMedium, PKDateStyleLong, PKDateStyleFull.


Value: Must be String
family[header][field][isRelative]
optional

If true, the label\'s value is displayed as a relative date; otherwise, it is displayed as an absolute date. The default value is false.


Value: Must be one of: true, false.
family[header][field][currencyCode]
optional

ISO 4217 currency code for the field's value.


Value: Must be String
family[header][field][numberStyle]
optional

Style of number to display. Must be one of the following values: PKNumberStyleDecimal, PKNumberStylePercent, PKNumberStyleScientific, PKNumberStyleSpellOut.


Value: Must be String
family[visual]
optional

Parameters related to the appearance of the pass


Value: Must be a Hash
family[visual][backgroundColor]
required

Background color of the pass, specified as an CSS-style RGB triple. For example, rgb(23, 187, 82).


Value: Must be String
family[visual][foregroundColor]
required

Foreground color of the pass, specified as a CSS-style RGB triple. For example, rgb(100, 10, 110).


Value: Must be String
family[visual][labelColor]
optional

Color of the label text, specified as a CSS-style RGB triple. For example, rgb(255, 255, 255). If omitted, the label color is determined automatically.


Value: Must be String
family[visual][logoText]
optional

Text displayed next to the logo on the pass.


Value: Must be String
family[visual][suppressStripShine]
optional

If true and a strip image is present, the strip image is displayed without a shine effect. The default value is false.


Value: Must be String
family[primary]
optional

An array of fields for the primary section


Value: Must be a Hash
family[primary][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[secondary]
optional

An array of fields for the secondary section


Value: Must be a Hash
family[secondary][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[auxiliary]
optional

An array of fields for the auxiliary section


Value: Must be a Hash
family[auxiliary][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[back]
optional

An array of fields for the back section


Value: Must be a Hash
family[back][field]
optional

Exactly like the field for the header section


Value: Must be Hash
family[custom]
optional

Value: Must be a Hash
family[custom][transitType]
required

Required for boarding passes; otherwise not allowed. Type of transit. Must be one of the following values: PKTransitTypeAir, PKTransitTypeBoat, PKTransitTypeBus, PKTransitTypeGeneric, PKTransitTypeTrain.


Value: Must be String
family[bar]
optional

An hash containing the Bar Section informations


Value: Must be a Hash
family[bar][message]
optional

The message to be put in the 2D code


Value: Must be String
family[bar][format]
required

Barcode format. Must be one of the following values: PKBarcodeFormatQR, PKBarcodeFormatPDF417, PKBarcodeFormatAztec.


Value: Must be String
family[bar][altText]
optional

The alternative text that will be put below the bar code.


Value: Must be String
family[bar][messageEncoding]
required

Text encoding that is used to convert the message from the string representation to a data representation to render the barcode. The value is typically iso-8859-1, but you may use another encoding that is supported by your barcode scanning infrastructure.


Value: Must be String
family[relevance]
optional

An hash containing the relevance informations like date, time and positions.


Value: Must be a Hash
family[relevance][locations]
optional

Array of locations where the pass will appear on the lockscreen


Value: Must be a Hash
family[relevance][locations][latitude]
required

Latitude


Value: Must be String
family[relevance][locations][longitude]
required

Longitude


Value: Must be String
family[relevance][locations][altitude]
optional

Altitude


Value: Must be String
family[relevance][locations][relevantText]
optional

Text that will appear on the lockscreen when the place is reached.


Value: Must be String
family[relevance][relevantDate]
optional

Date and Time when the pass will appear on the lockscreen. Use ISO8601 format.


Value: Must be String
limit_to_1_device
optional

Limit to 1 device per pass


Value: Must be one of: 0, 1.
debug
optional

You get in response a JSON with the created object.


Value: Must be one of: true, false.
errors
optional

If an error occurs you get the messages and not only the code.


Value: Must be one of: true, false.

DELETE /api/v1/templates/:id
Delete Template

Destroy a Template.

Supported Formats

json

Success Response:

200 Deleted

Errors

400 Bad Request
401 Unauthorized
404 Template Not Found

Examples

curl -i -X DELETE https://api.passdock.com/api/v1/templates/106?api_token=75778a65dfdae310a107d2ef0bbd3780

Params

Param name Description
id
required

Template ID


Value: Must be Fixnum
api_token
required

Your Passdock API key


Value: Must be String

GET /api/v1/templates/:id/fields
Get Editable Fields

Get editable fields for a desired Template.

You will get an array of editable fields. Each field is named with the key of the field. For each field you get an array of editable options:

  • value means that you can set the value for each Pass;
  • label means that you can set the lable for each Pass;
  • changeMessage means that you can set a different change message for each pass.

In the same array you get the field type if it isn't a String:

  • date means that the field is a date and you must write the value in the ISO8601 format;
  • time means that the field is a time and you must write the value in the ISO8601 format;
  • currency means that the field represent money and you must write the value in the ISO4217 format;
  • number means that the field is a number.

Besides the array fields you can get another array with the images that can be set for each Pass:

  • thumbnail means that you can upload a thumbnail for each Pass.

Supported Formats

json

Success Response:

200 Good Request
                  
{
  "fields": [
    {
      "year": [
        "value",
        "date"
      ]
    },
    {
      "name": [
        "value",
        "label",
        "changeMessage"
      ]
    }
  ],
  "images": [
    "thumbnail"
  ]
}
              

Errors

401 Unauthorized
404 Template Not Found

Examples

curl -i https://api.passdock.com/api/v1/templates/fields?api_token=75778a65dfdae310a107d2ef0bbd3780

Params

Param name Description
id
required

Template ID


Value: Must be Fixnum
api_token
required

Your Passdock API key


Value: Must be String