# Connecting to the PassKit API with Ruby

DevFeed: [Connecting to the PassKit API with Ruby](<https://devfeed.tech/articles/connecting-to-the-passkit-api-with-ruby-20768.md>)

Original publisher: [Read original article](<https://erikrunyon.com/2022/02/connecting-to-the-passkit-api-with-ruby/>)

Author: Erik Runyon

Published: 2022-02-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [Erik Runyon](<https://devfeed.tech/sources/erik-runyon.md>)

Topics: [API](<https://devfeed.tech/topics/api.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [JSON Web Tokens](<https://devfeed.tech/topics/jwt.md>), [payload](<https://devfeed.tech/topics/payload.md>), [Authorization](<https://devfeed.tech/topics/authorization.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [authorization](<https://devfeed.tech/tags/authorization.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jwt](<https://devfeed.tech/tags/jwt.md>), [payload](<https://devfeed.tech/tags/payload.md>), [rest](<https://devfeed.tech/tags/rest.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [web-development](<https://devfeed.tech/tags/web-development.md>)

## AI overview

This tutorial demonstrates how to connect to the PassKit API using Ruby. It explains generating a JWT payload and token, then sending the token in an Authorization header with HTTParty to access and modify API endpoints.

## Source excerpt

We were recently testing PassKit as a way of managing membership cards for giving societies. Passkit is very up-front that they are not a CRM and strongly suggest using their API for integrating with outside systems, or for editing pretty much any data. To kick the tires, we set up some very basic scripts to connect to the Passkit API. A REST example can be found on their docs. The example below shows how to get a programs's info using Ruby. The process consists of two steps: Generate the payload and token using the jwt gem. Connect to the API endpoint using HTTParty passing the token value with the "Authorization" header. That's it! From there you can modify the HTTParty path for whatever endpoint you need. Just be sure to adjust the verb and "body" in the call accordingly. PassKit API docs