Jumpstart docs logo Back to the app

API Endpoints

Jumpstart Pro can provide API access to your application with API tokens and authentication already handled for you.

API Tokens

Every user in Jumpstart Pro can have multiple API tokens. They can create and revoke tokens on API section of their user settings.

Tokens keep track of the time they were last used so users can verify their integrations are working correctly and keep an eye on them.

API Authentication

Authentication with the Jumpstart Pro API is as simple as passing in the Authorization header. We provide an example of this header on the API token page to make it easy for users to implement

An example Authorization header would look like the following:

GET /api/v1/me.json
Authorization: Bearer exampletoken

If you'd like to authenticate users through the API using their email and password to retrieve an API token, you can make a POST request to the auth endpoint with the user's email and password. This is handy for authenticating from a mobile app, etc.

POST /api/v1/auth.json
Params: { email: "steve@apple.com", password: "hunter2" }

This will return a JSON response with a token you can use to access the API.

{ token: "abcd1234" }

API Controllers & Routes

API controllers are defined in app/controllers/api/v1/. We provide a /api/v1/me.json and /api/v1/accounts.json endpoint out of the box. You can use these controllers as examples to base your API endpoints off of.

API controllers should inherit from Api::BaseController instead of ApplicationController. This enables API authentication. To skip authentication on an endpoint, add skip_before_action :authenticate_api_token! to your actions.

Authentication works with Devise so you can access current_user just like normal.

Since APIs don't have sessions, there is no current_account equivalent like in the main app. You can use nested resources in the API to scope things under accounts if you want to separate them. For example: /api/v1/accounts/2/projects/4.json.

API Responses

API controllers are configured to return JSON by default.

We use JBuilder by default to provide simple JSON templates that most users are already familiar with. To improve JBuilder performance, we have added the OJ gem for enhanced JSON performance.

We also recommend checking out the fast_jsonapi gem from Netflix if you'd like to use an alternative.