OAuth API

Connected AI tools and the service-account token endpoint. 4 routes; send a bearer token with each (see Authentication).

Route What it does
POST /v1/oauth/connector-company Choose the company an OAuth connector works in
GET /v1/oauth/connected-apps My connected apps
DELETE /v1/oauth/connector-company/{clientId} Forget the company chosen for an OAuth connector
POST /oauth/token Service-account token (client credentials)

Choose the company an OAuth connector works in

POST https://staging-api.naruskacrm.com/v1/oauth/connector-company

Called by the consent page before approving. Tokens issued to that client then carry this company, whatever the active company in the web app.

Request body

Field Type Required Notes
client_id string yes 1–200 characters
company_id string (uuid) yes

Response 204

Done. No body.

Errors are problem details with a stable code: see Errors.

My connected apps

GET https://staging-api.naruskacrm.com/v1/oauth/connected-apps

The OAuth clients you have granted access, with the hosts they return to and the company each works in. Revoke a grant with Supabase Auth, then forget its company here.

Response 200

Field Type Always present Notes
data array of ConnectedApp yes

Errors are problem details with a stable code: see Errors.

Forget the company chosen for an OAuth connector

DELETE https://staging-api.naruskacrm.com/v1/oauth/connector-company/{clientId}

Part of disconnecting an app: after the grant is revoked, its stored company choice is deleted. Idempotent.

Parameters

Parameter In Type Required Notes
clientId path string yes 1–200 characters

Response 204

Done. No body.

Errors are problem details with a stable code: see Errors.

Service-account token (client credentials)

POST https://staging-api.naruskacrm.com/oauth/token

RFC 6749 client credentials: client_id (nrk_sa_…) and client_secret (nrk_sec_…) by HTTP Basic or form. Returns a 15-minute bearer token. Optional scope narrows the credential’s scopes.

No bearer token: see the description.

Request body (optional)

Form-encoded (application/x-www-form-urlencoded).

Field Type Required Notes
grant_type client_credentials yes
client_id string
client_secret string
scope string

Response 200

Token.

Field Type Always present Notes
access_token string yes
token_type Bearer yes
expires_in number yes
scope string yes

Response 400

unsupported_grant_type or invalid_scope.

Response 401

invalid_client.

Errors are problem details with a stable code: see Errors.