Skip to Content
IntegrationsBuilding Integrations

Building Integrations with the ScopeStack API

1. How ScopeStack Authentication Works

Before diving into implementation, it helps to understand how the pieces fit together.

Two Types of Client Credentials

ScopeStack uses OAuth 2.0 Client IDs and Client Secrets. There are two kinds, and which one you use depends on your authentication flow.

Account-level credentials are issued per ScopeStack account. These identify your application and are used with the Authorization Code and Password Grant flows. They do not carry user identity on their own. You provide a username and password (or a browser login) separately to identify which user is making the request.

Service Account credentials are issued per service account user. These identify both the application and the user in a single pair. They are used with the Client Credentials flow and do not require a separate username or password. This is the recommended approach for new server-to-server integrations. See Service Account Credentials for setup.

Users Determine Access

Every API request ultimately runs as a specific ScopeStack user. The user determines:

  • Which account the request operates in (if a user belongs to multiple accounts)
  • What permissions are available (based on the user’s role)

With account-level credentials, the user is determined by the login or password you provide. With service account credentials, the user is the service account that owns the credentials.

Two Domains, Two Purposes

DomainUse
app.scopestack.ioAuthentication (getting tokens)
api.scopestack.ioAPI calls (using tokens)

2. Choosing an Authentication Flow

ScopeStack supports three OAuth 2.0 flows. Your choice depends on whether a human will be present during authentication.

ScenarioFlowWhy
Web app where users log inAuthorization CodeUser can complete browser login
Interactive Postman testingAuthorization CodeYou’re at the keyboard
Workato / ZapierClient CredentialsNo browser, no passwords needed
Backend service / cron jobClient CredentialsSingle request, runs unattended
MCP server connectionsClient CredentialsHeadless server-to-server access
Custom scriptsClient CredentialsAutomated execution
Existing integrations using password grantPassword GrantStill supported for existing setups

3. Authorization Code Flow

Use this flow when a user can complete a browser-based login.

How It Works

  1. Your application redirects the user to ScopeStack’s authorization endpoint
  2. The user logs into ScopeStack (through their identity provider, including its MFA, if the account uses SSO)
  3. ScopeStack redirects back to your callback URL with an authorization code
  4. Your application exchanges the code for an access token

Endpoints

4. Client Credentials Flow

Use this flow for server-to-server integrations, automation platforms, and MCP connections. A single request exchanges your service account’s client ID and secret for an access token.

Setup

Create a service account and generate client credentials. See Service Account Credentials for the full walkthrough.

Token Request

POST https://app.scopestack.io/oauth/token

Content-Type: application/x-www-form-urlencoded

ParameterValue
grant_typeclient_credentials
client_idYour service account’s Client ID
client_secretYour service account’s Client Secret

Response

{

"access_token": "eyJ...",

"expires_in": 86400,

"token_type": "Bearer"

}

No refresh token is returned. When the token expires, make the same request again to get a new one.

5. Resource Owner Password Grant

This flow is supported for existing integrations. For new integrations, use Client Credentials (above) instead.

Use this flow for automation—no browser, no redirect, just a direct token exchange.

⚠️ Postman Users: If you’re testing this flow in Postman, do NOT use the OAuth 2.0 helper with “Password Credentials” selected. That sends a redirect_uri parameter that causes errors. Instead, make a direct POST request to the token endpoint. See the Quick Start guide for step-by-step instructions.

Token Request

POST https://app.scopestack.io/oauth/token

Content-Type: application/x-www-form-urlencoded

ParameterValue
grant_typepassword
client_idYour application’s Client ID
client_secretYour application’s Client Secret
usernameService account email
passwordService account password

Response

{

"access_token": "eyJ...",

"refresh_token": "abc123...",

"expires_in": 86400,

"token_type": "Bearer"

}

6. Setting Up Service Accounts

For production integrations, always use a dedicated service account rather than a personal user account. This ensures your integration keeps working when people leave the company.

Creating a Service Account

  1. In ScopeStack, go to Settings > Users & Groups > Users
  2. Click Add a User
  3. Under User Type, Teams, and Roles, choose Service. A Change to Service Account dialog explains that a service account can access the ScopeStack API but cannot log in to the pages of the application. Click Continue to confirm.
  4. Enter a name and an email address
  5. Assign a role with appropriate permissions
  6. Click Save

Setting Up Client Credentials

Once the service account exists, create client credentials for it. See Service Account Credentials for the full walkthrough.

Best Practices

  • Create a dedicated “Integration” or “Service Account” role with only the permissions your integration needs
  • Use descriptive email addresses like workato@yourcompany.com or salesforce-sync@yourcompany.com
  • Document which service account is used for which integration
  • Use separate client credentials for separate integrations
  • Rotate secrets periodically per your security policy

7. Token Management

Token Expiration

Access tokens expire after the number of seconds in expires_in. Plan to renew them before they expire. For Client Credentials, repeat your original token request.

Refreshing Tokens

If your token response includes a refresh token, use it to get a new access token without signing in again. For Client Credentials, repeat the original request with the same client ID and secret.

POST https://app.scopestack.io/oauth/token

Content-Type: application/x-www-form-urlencoded

ParameterValue
grant_typerefresh_token
client_idYour Client ID
client_secretYour Client Secret
refresh_tokenThe refresh token from your original token response

Handling Token Errors

On a token-related 401 Unauthorized, renew the token using your OAuth flow. Repeat the Client Credentials request, use the refresh token if your flow returned one, or sign in again if you need a new authorization code.

On 403 Forbidden, inspect the response and check the role privilege required for the request. If POST /oauth/token returns 403 after repeated token requests, check the token rate-limit guidance before trying again.

8. Making API Calls

Required Headers

Every API call must include:

Authorization: Bearer {access_token}

Accept: application/vnd.api+json

The Accept header is required—calls without it may fail.

Getting Account Context

After authenticating, call GET https://api.scopestack.io/v2/me to see the token user’s active account-slug and account-id. Use the slug in V1 URLs such as /my-account/v1/clients. V2 URLs omit the slug.

Some resources take the account from the token. For example, when creating a rate table, omit the account relationship. The V1 and V2 APIs use the token user’s active account and ignore an account supplied in the body.

The same applies to survey creation. For example, send this JSON:API body to POST /v2/surveys with a questionnaire ID from the active account:

{ "data": { "type": "surveys", "relationships": { "questionnaire": { "data": { "type": "questionnaires", "id": "123" } } } } }

If the survey does not appear where you expect it, check account-id and account-slug with GET /v2/me using the same token.

Pagination

List endpoints are paginated. Control the page with page[number] and page[size]:

GET https://api.scopestack.io/v2/projects?page[number]=1&page[size]=250

  • The default page size is 250. The maximum accepted is 1000 — a larger value returns a 400 telling you the size exceeds the maximum.
  • Every list response includes a meta object with record-count (total matching records) and page-count (number of pages). Read page-count once and loop, rather than paging until you get an empty response.
  • Responses also include links with first, next, and last URLs where applicable.

Filtering

Filters use the JSON:API filter[...] convention. Which filters a resource accepts varies by endpoint; the Swagger UI lists them per endpoint.

Use GET /v2/projects?filter[search]=acme to search several project fields at once. The filter applies when the trimmed search term has at least three characters. It matches project and client names, active teammate names, the sales executive and presales engineer, and active text User Defined Fields on the project. For dropdown fields, it matches the label shown to users. This filter is available in V2 only.

Archived records are excluded by default. Many collections — including projects — support filter[active], which controls whether archived records are returned. Collections with no concept of archiving do not accept it:

ValueReturns
omittedActive records only — this is the default
filter[active]=trueActive records only (identical to omitting it)
filter[active]=falseArchived records only
filter[active]=true,falseBoth active and archived

High-volume paging can trip rate limits on document and export endpoints — see 429 Too Many Requests.

This catches people out in two directions. If you are missing records you expected, they may be archived and silently excluded. If you are trying to reconcile a total against the ScopeStack UI, make sure both sides agree on whether archived records count.

Child records do not inherit their parent’s archived state. For example, /v1/resource-rates returns rates that belong to archived rate tables. To return only rates on active tables, filter by those tables’ IDs (comma-separated): /{account-slug}/v1/resource-rates?filter[rate-table]=765,1058. List your active rate tables first with /{account-slug}/v1/rate-tables, which excludes archived tables by default.

9. Using the ScopeStack Workato Connector

ScopeStack provides a pre-built Workato connector that handles authentication, token refresh, and common operations automatically.

The connector is being updated to support the Client Credentials flow. Contact ScopeStack for access to the connector and setup information.

10. API Reference

Full API documentation is available at https://api.scopestack.io  (Swagger UI).

The API follows JSON:API conventions. Key patterns:

  • GET /{account-slug}/v1/{resource} — List resources
  • GET /{account-slug}/v1/{resource}/{id} — Get single resource
  • POST /{account-slug}/v1/{resource} — Create resource
  • PATCH /{account-slug}/v1/{resource}/{id} — Update resource
  • DELETE /{account-slug}/v1/{resource}/{id} — Delete resource

Use a lifecycle action to change the status of an existing project. In V1 and V2, the ordinary project PATCH does not accept status. In V2, submit for approval with PUT /v2/projects/{id}/approval-requests, cancel approval with PUT /v2/projects/{id}/approval-cancellations, or return the project to Building with PUT /v2/projects/{id}/rescope-requests.

Questions? Contact ScopeStack support via chat or email.

Generating and downloading documents

Three things about generated documents catch integrators out. All three are easier to design around than to debug.

The download URL is authenticated. Since 10 August 2026 the document-url attribute on project-documents and document-requests, on both v1 and v2, points at a ScopeStack API endpoint rather than a storage link. You can store and reuse the URL while the document or request is available. Send a valid Bearer token with current download permission on every request. If an external system needs the file, have your integration fetch the bytes and pass them along.

Changing the project clears its documents. A generated document belongs to one project state, and editing the project removes the documents generated from it outright. A generate-then-change-then-download sequence can lose the file between the two steps. Make generation the last thing you do, let the project settle, and download promptly. See How Document Generation Works for what counts as a change.

Over the MCP, ask for the download URL explicitly. scopestack_list_project_items with type: "document_status" returns the generation status and mime_type by default. Add response_format: "detailed" to get a signed download_url and its expires_at. The link is a credential valid for five minutes, which is why it is minted on request rather than on every poll. See the MCP tool reference.

Uploading and downloading project attachments

  1. Create the record with POST /v2/project-attachments. Send JSON:API and link the project in the active account. This step requires Create or higher on the Attachments permission.

    { "data": { "type": "project-attachments", "attributes": {}, "relationships": { "project": { "data": { "type": "projects", "id": "123" } } } } }
  2. Use the returned attachment ID in POST /v2/project-attachments/{id}/upload. Send the file as project_attachment[document] in a multipart/form-data request. The same endpoint replaces an existing file. Uploading requires Manage.

  3. To download the file bytes, send an authenticated GET /v2/project-attachments/{id}/downloads with the attachment ID. This requires View or higher.

When a sync stops delivering data

If records stop arriving from an integration platform such as Workato, check the job history for the recipe, not the connection’s health indicator.

A connection can report a healthy authorization while every job still fails at the step that writes to the destination system, because an action-level credential rejection never updates the connection record. Individual jobs can also finish with a status of succeeded after exiting early on a conditional branch, so a run of green jobs is not proof that anything was delivered.

Open a failed job and read the step-level error. The step name plus the error text tells you which side rejected the request, which is usually enough to know whether the fix belongs on the ScopeStack side or the destination side.

Note that development and production environments use separate connections and separate recipes, so confirming one is healthy says nothing about the other.

New to ScopeStack?

ScopeStack automates scoping, pricing, and SOW generation for IT services teams. See how it fits your process.

Book a demoBrowse the docs
Last updated on