Introduction

The StoryPrompt API gives you read-only access to many of the things you can access on the StoryPrompt web app. This documentation describes all of the available API calls and properties of the returned objects. If you have any questions, please reach out to [email protected].

Getting Started

Authentication

StoryPrompt’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://app.storyprompt.com/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 https://oauthdebugger.com/. | | Access Token Request | https://us-central1-storyprompt-90b1f.cloudfunctions.net/access | POST | client_id token | This call returns an access_token and a refresh_token. | | Refresh Token Request | https://us-central1-storyprompt-90b1f.cloudfunctions.net/refresh_token | POST | client_id token | This call returns a new access_token. | | Test Token Request | https://us-central1-storyprompt-90b1f.cloudfunctions.net/test_token | GET | access_token | This call can be used to check the validitiy 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://us-central1-storyprompt-90b1f.cloudfunctions.net/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

Refresh tokens allow you to obtain a new access token without prompting the user to authenticate again.