API Reference
Authentication
Authenticate with the Demoship API using API keys or OAuth 2.0.
The Demoship API supports two authentication methods: API keys for server-to-server integrations and OAuth 2.0 for user-facing applications.
API keys
Generating a key
- Go to Settings > API > Keys.
- Click Create Key.
- Name the key and select the scopes it should have.
- Copy the key immediately -- it is shown only once.
Using the key
Pass the API key in the Authorization header:
curl https://api.demoship.com/v1/demos \
-H "Authorization: Bearer dsk_your_api_key"const response = await fetch('https://api.demoship.com/v1/demos', {
headers: {
'Authorization': 'Bearer dsk_your_api_key'
}
});
const data = await response.json();import requests
response = requests.get(
'https://api.demoship.com/v1/demos',
headers={'Authorization': 'Bearer dsk_your_api_key'}
)
data = response.json()OAuth 2.0
For applications that act on behalf of a user, use the OAuth 2.0 authorization code flow.
Setup
- Go to Settings > API > OAuth Apps.
- Click Create App.
- Enter a name, redirect URI, and select scopes.
- Note the Client ID and Client Secret.
Authorization flow
- Redirect the user to the authorization endpoint:
https://app.demoship.com/oauth/authorize?
client_id=your_client_id&
redirect_uri=https://yourapp.com/callback&
response_type=code&
scope=demos:read demos:write- After the user authorizes, Demoship redirects to your callback with a code.
- Exchange the code for an access token:
curl -X POST https://api.demoship.com/v1/oauth/token \
-d "grant_type=authorization_code" \
-d "code=the_auth_code" \
-d "client_id=your_client_id" \
-d "client_secret=your_client_secret" \
-d "redirect_uri=https://yourapp.com/callback"Token refresh
Access tokens expire after 1 hour. Use the refresh token to get a new access token:
curl -X POST https://api.demoship.com/v1/oauth/token \
-d "grant_type=refresh_token" \
-d "refresh_token=your_refresh_token" \
-d "client_id=your_client_id" \
-d "client_secret=your_client_secret"Scopes
| Scope | Access |
|---|---|
demos:read | List and read demos |
demos:write | Create, update, and delete demos |
analytics:read | Read engagement data |
shares:read | List share links |
shares:write | Create and manage share links |
team:read | List team members |
team:write | Invite and manage team members |
webhooks:write | Create and manage webhooks |
Security best practices
- Store API keys in environment variables, not in source code
- Use the minimum scopes required for your integration
- Rotate keys regularly in Settings > API > Keys
- Revoke keys immediately if compromised
- Use OAuth 2.0 for user-facing applications instead of sharing API keys