Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-source-swapcard npm version

A plugin for sourcing data from Swapcard API into your Gatsby project.

This plugin makes use of the gatsby internal API in order for you to be able to run gatsby-plugin-sharp on the available images.

See the Swapcard API Docs for more information on their APIs.


npm install --save gatsby-source-swapcard

How to use

Configure the plugin in your gatsby-config.js:

  resolve: `gatsby-source-swapcard`,
  options: {
    // Swapcard API accessToken
    accessToken: process.env.ACCESS_TOKEN,
    // Your event id
    eventId: `=====`,

To retrieve these information you need to ask Swapcard for an API token and then use it in the Playground in order to get the eventId of the event you wish. Here’s an example query to get this information:

  events {

Note: Don’t forget to set the HTTP Headers into something like:

  "Authorization": "accessToken"

How to Query

Depending on your accessToken and your enabled features you will be able to retrieve the following information:

  • event details (allSwapcardEvent or swapcardEvent)
  • speakers (allSwapcardSpeakers or swapcardSpeaker)
  • planning (allSwapcardPlanning or swapcardPlanning)
  • attendees (allSwapcardAttendee or swapcardAttendee)
  • exhibitors (allSwapcardExhibitor or swapcardExhibitor)

The available fields on each resource are the same as retrieved from the API Whenever a resource has an associated image you can run gatsby-plugin-sharp on the node as the following example:

  allSwapcardAttendee {
    edges {
      node {
        localFile {
          childImageSharp {
            fluid(maxWidth: 600) {
© 2023 Gatsby, Inc.