Consume an integration OAuth transaction

Consumes the OAuth transaction whose ID was received as the state of an OAuth callback. A transaction can be consumed once, by the integration that it was created for, and only with the authorization code that the user who started the connection confirmed in GitBook. Returns the installation the credentials must be written to, the PKCE code verifier, and a single-use grant to pass as oauthTransaction when writing the credentials.

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
integrationNamestring · max: 100Required

Name of the integration.

Pattern: ^[a-zA-Z0-9-_.]+$
transactionIdstringRequired

ID of the OAuth transaction, as received in the state parameter

Body
redirectUristringRequired

The exact redirect_uri sent to the provider's authorize and token endpoints.

codestringRequired

The authorization code received on the callback.

Responses
200

The transaction has been consumed.

application/json
objectstring · enumRequiredPossible values:
idstringRequired
organizationstringRequired

ID of the organization of the installation.

installationstringRequired

ID of the installation the credentials must be written to.

spacestringOptional

ID of the space whose installation the credentials must be written to.

sitestringOptional

ID of the site whose installation the credentials must be written to.

codeVerifierstringRequired

PKCE code verifier, to send as code_verifier when exchanging the code.

redirectUristringRequired

The validated redirect URI.

grantExpiresAtstring · date-timeRequired
post/integrations/{integrationName}/oauth-transactions/{transactionId}/consume
POST /v1/integrations/{integrationName}/oauth-transactions/{transactionId}/consume HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 36

{
  "redirectUri": "text",
  "code": "text"
}
{
  "object": "integration-oauth-transaction",
  "id": "text",
  "organization": "text",
  "installation": "text",
  "space": "text",
  "site": "text",
  "codeVerifier": "text",
  "redirectUri": "text",
  "grantExpiresAt": "2026-01-01T00:00:00.000Z"
}

Last updated

Was this helpful?

Powered by GitBook