Introduction

The Swarm API gives you read-only access to many of the things you can access on the swarm web app. This documentation describes all of the available API calls and properties of the returned objects. Please note: we also have an invite-only Zapier integration.

If you have any questions about our API or Zapier integration, please reach out to [email protected].

Getting Started

Authentication

Swarm’s API uses oAuth 2.0 to handle authentication. To request a client ID, please contact [email protected]. The following oAuth 2.0 endpoints are made available:

oAuth2 Call Endpoint Method Parameters Notes
Authorization Url https://we.swarm.to/login GET client_id
redirect_uri
response_type=code Following authentication, the user is redirected back to your redirect_uri with a token that can be converted to an access token using the Access Token Request below.

You can test the oAuth flow using oauthdebugger. | | Access Token Request | https://we.swarm.to/api/v1/token/access | POST | client_id token | This call returns an access_token and a refresh_token. | | Refresh Token Request | https://we.swarm.to/api/v1/token/refresh_token | POST | client_id token | This call returns a new access_token. | | Test Token Request | https://we.swarm.to/api/v1/token/test_token | GET | access_token | This call can be used to check the validity of an access token. If it’s invalid, a 401 error is returned. |

How long will my access token stay valid?

By default, the access token you create will only be valid for 1 hour.

Checking the validity of a token

To check the validity of a token, make the following GET request:

<https://we.swarm.to/api/v1/token/test_token?access_token=>{YOUR ACCESS TOKEN}

Example Response

{
  "uid": "...",
  "email": "xxx@xxx"
}

If the access token is no longer valid, a 401 error will be returned. Access tokens are set to expire after 1 hour and need to be refreshed.

Refresh tokens