SheetgoDevelopers

Developers › REST API › Authentication

REST API · 2 endpoints

auth

Complete for this group. Each operation below lists its parameters, request body, responses and errors. Every model they use is documented under Models used on this page, so you do not need another page to build a request. Base URL https://dev-api.sheetgo.com; send Authorization: Bearer sg_…. Latest version: https://dev-api.sheetgo.com/rest/reference/auth (Markdown).

Conventions for every endpoint. Lists take page (from 1) and per_page (1-100, default 50), and total counts pages, not items. Collection URLs end with /. POST …/run returns 200 when the run is queued; poll GET …/run. Google Sheets use provider: "drive"; column fields take letters ("E"). Error bodies and status codes: api.html#api-errors.

Python recipes. API client helper.

OAuth2 authorization endpoints — exchange a Client ID / Client Secret for an access token, for developer and customer integrations. For most use cases an API key generated on your Account page is simpler (see Authentication above).

Operations

POST/rest/auth/refreshCreates a new access token from a refresh token

Exchanges a refresh token for a fresh access token, so a long-running integration never has to send the user back through the authorize screen.

grant_type must be refresh_token. A token that has expired, been revoked or is unknown answers 401 — restart the authorization-code flow from the beginning.

client_id and client_secret are verified: a refresh token alone is not sufficient. A deleted or disabled application is refused.

Request body (required)

application/json · RefreshTokenRequest

FieldTypeDescription
client_idstringrequiredYour application's client id.
client_secretstringrequiredYour application's client secret. Never expose it in a browser or mobile client.
grant_typestringoptionalOAuth2 grant type. Must be refresh_token for this endpoint.
Default: "refresh_token"
refresh_tokenstringrequiredThe refresh token previously issued by POST /rest/auth/token.
Responses
StatusMeaningBody
200A new access tokenExchangedToken
401Refresh token expired, revoked or unknown—
404Not found—
422Validation ErrorHTTPValidationError
Example request
curl -s -X POST "https://dev-api.sheetgo.com/rest/auth/refresh" \
  -H "Authorization: Bearer $SHEETGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d @body.json
POST/rest/auth/tokenExchange authentication code for a access token and a refresh token

Second leg of the OAuth2 authorization-code flow: trades the one-time code your redirect URI received for an access token and a refresh token.

The body is form-encoded (application/x-www-form-urlencoded), not JSON. grant_type must be authorization_code, and redirect_uri must match the one used to obtain the code.

Codes are single-use and short-lived. Bad credentials, a reused code or a mismatched redirect URI all answer 401.

Request body (required)

application/x-www-form-urlencoded · Body_auth_token_rest_auth_token_post

FieldTypeDescription
client_idstringrequiredYour application's client id.
client_secretstringrequiredYour application's client secret. Never expose it in a browser or mobile client.
codestringrequiredThe single-use authorization code returned to your redirect URI by the authorize step.
grant_typestringrequiredOAuth2 grant type. Must be authorization_code.
redirect_uristringrequiredThe same redirect URI that was used to obtain code. It must match your application's registered URI exactly.
Responses
StatusMeaningBody
200Access and refresh tokenExchangedToken
401Invalid code, client credentials or redirect_uri—
404Not found—
422Validation ErrorHTTPValidationError
Example request
curl -s -X POST "https://dev-api.sheetgo.com/rest/auth/token" \
  -H "Authorization: Bearer $SHEETGO_API_KEY" \
  --data-urlencode "FIELD=VALUE"

Models used on this page

Every request and response model referenced above, including nested ones (5). The full catalogue is on api-models.html.

Body_auth_token_rest_auth_token_post

FieldTypeDescription
client_idstringrequiredYour application's client id.
client_secretstringrequiredYour application's client secret. Never expose it in a browser or mobile client.
codestringrequiredThe single-use authorization code returned to your redirect URI by the authorize step.
grant_typestringrequiredOAuth2 grant type. Must be authorization_code.
redirect_uristringrequiredThe same redirect URI that was used to obtain code. It must match your application's registered URI exactly.

Used by: POST /rest/auth/token

ExchangedToken

The token pair returned by the OAuth2 token and refresh endpoints.

FieldTypeDescription
access_tokenstringrequiredShort-lived bearer token. Send it as Authorization: Bearer <access_token> on API calls.
refresh_tokenstringrequiredLong-lived token used to obtain a new access token from POST /rest/auth/refresh once the access token expires. Store it securely; it is as sensitive as a password.

Used by: POST /rest/auth/refresh, POST /rest/auth/token

HTTPValidationError

FieldTypeDescription
detailarray of ValidationErroroptional

Used by: GET /rest/beta/workflows/, POST /rest/beta/workflows/, POST /rest/beta/workflows/run/{id}, GET /rest/beta/workflows/{id}, PATCH /rest/beta/workflows/{id}, DELETE /rest/beta/workflows/{id}, GET /rest/beta/workflows/{id}/collaborators, POST /rest/beta/workflows/{id}/collaborators, DELETE /rest/beta/workflows/{id}/collaborators, PATCH /rest/beta/workflows/{id}/collaborators/{email}, DELETE /rest/beta/workflows/{id}/collaborators/{email}, GET /rest/beta/workflows/{id}/destinations, GET /rest/beta/workflows/{id}/files, GET /rest/beta/workflows/{id}/general-access, PUT /rest/beta/workflows/{id}/general-access, DELETE /rest/beta/workflows/{id}/general-access, POST /rest/beta/workflows/{id}/leave, POST /rest/beta/workflows/{id}/request-access, GET /rest/beta/workflows/{id}/run, POST /rest/beta/workflows/{id}/run, GET /rest/beta/workflows/{id}/sources, GET /rest/beta/automations/, POST /rest/beta/automations/run/{id}, GET /rest/beta/automations/{id}, DELETE /rest/beta/automations/{id}, GET /rest/beta/automations/{id}/destinations, GET /rest/beta/automations/{id}/files, GET /rest/beta/automations/{id}/run, POST /rest/beta/automations/{id}/run, GET /rest/beta/automations/{id}/sources, GET /rest/beta/workflows/{id}/trigger, DELETE /rest/beta/workflows/{id}/trigger, GET /rest/beta/workflows/{id}/dashboard, DELETE /rest/beta/workflows/{id}/dashboard/elements/{element_id}, GET /rest/beta/workflows/{id}/dashboard/elements/{element_id}/data, PUT /rest/beta/workflows/{id}/dashboard/publish, GET /rest/beta/workflows/{workflow_id}/forms/, POST /rest/beta/workflows/{workflow_id}/forms/, GET /rest/beta/workflows/{workflow_id}/forms/{form_id}, PATCH /rest/beta/workflows/{workflow_id}/forms/{form_id}, DELETE /rest/beta/workflows/{workflow_id}/forms/{form_id}, GET /rest/beta/workflows/{workflow_id}/forms/{form_id}/responses, HEAD /rest/beta/workflows/{workflow_id}/forms/{form_id}/responses, GET /rest/beta/automations/{automation_id}/webhook, GET /rest/beta/workflows/{workflow_id}/webhooks, GET /rest/beta/api-destination/{public_id}, HEAD /rest/beta/api-destination/{public_id}, GET /rest/beta/integrations/{provider}/options, GET /rest/beta/outlook/messages, POST /rest/beta/outlook/messages/batch, GET /rest/beta/outlook/messages/{message_id}, GET /rest/beta/outlook/messages/{message_id}/attachments/{attachment_id}, POST /rest/beta/outlook/send, POST /rest/beta/gmail/send, GET /rest/beta/files/{provider}, GET /rest/beta/files/{provider}/roots, GET /rest/beta/files/{provider}/search, GET /rest/beta/files/{provider}/{file_id}, GET /rest/beta/bigquery/projects, GET /rest/beta/bigquery/projects/{project}/datasets, GET /rest/beta/bigquery/projects/{project}/datasets/{dataset}/tables, GET /rest/beta/bigquery/projects/{project}/datasets/{dataset}/tables/{table}, POST /rest/beta/bigquery/projects/{project}/validate-query, POST /rest/auth/refresh, POST /rest/auth/token

RefreshTokenRequest

The parameters used when refreshing a token

FieldTypeDescription
client_idstringrequiredYour application's client id.
client_secretstringrequiredYour application's client secret. Never expose it in a browser or mobile client.
grant_typestringoptionalOAuth2 grant type. Must be refresh_token for this endpoint.
Default: "refresh_token"
refresh_tokenstringrequiredThe refresh token previously issued by POST /rest/auth/token.

Used by: POST /rest/auth/refresh

ValidationError

FieldTypeDescription
locarray of string or integerrequired
msgstringrequired
typestringrequired