Skip to content

Connected sources

Connect Google Drive and attach its files and folders to a project.

OperationRequest
List account connectionsGET /v1/connections
Disconnect account googleDELETE /v1/connections/google
Create google consent linkPOST /v1/connections/google/connect
Browse account driveGET /v1/connections/google/drive
Run account drive toolPOST /v1/connections/google/tools/{tool}
List connected project sourcesGET /v1/projects/{id}/sources
Attach connected project sourcePOST /v1/projects/{id}/sources
Detach connected project sourceDELETE /v1/projects/{id}/sources/{source}

List account connections

GET /v1/connections · listAccountConnections

Read this account's stored connection metadata and sources. available describes server configuration, not Google permission or an access-token check. The response is not paginated.

Sign-in: a bearer credential in the Authorization header.

connectionBearer: A current account sess_ session or oa_sk_ sign-in key. Cookies and oak_ keys are refused. Connections must also be enabled for this account by the Google availability access list; other accounts receive 404 not_found. Google consent and Drive access are additional requirements, never implied by project membership.

Response

200 — The current result.

Type: AppConnectionList

FieldTypeRequiredDescription
availablebooleanYes
googleAppConnectionGoogleYes
google.statusAppConnectionState (one of "connected", "not_connected", "reconnect", "unavailable")Yes
google.emailstring or nullYes
google.scopesarray of stringYes
google.sheetsbooleanYes
google.featuresAppConnectionFeaturesYes
google.features.drivebooleanYes
google.features.sheetsbooleanYes
google.features.gmailbooleanYes
google.features.gmail_composebooleanYes
google.features.calendarbooleanYes
google.features.calendar_eventsbooleanYes
google.connected_atstring (date-time) or nullYes
connectionsarray of AppConnectionStoredYes
connections[].integrationstringYes
connections[].namestringYes
connections[].identitystring or nullYes
connections[].statusAppConnectionState (one of "connected", "not_connected", "reconnect", "unavailable")Yes
connections[].scopesarray of stringYes
connections[].sheetsbooleanYes
connections[].connected_atstring (date-time)Yes
connections[].reconnectbooleanYes
connections[].toolsarray of AppConnectionToolYes
connections[].tools[].idstringYes
connections[].tools[].addressstringYes
connections[].tools[].policyone of "allow", "require_approval", "block"Yes
connections[].tools[].descriptionstringYes
connections[].tools[].parametersobjectYes
sourcesarray of objectYes
sources[].projectstringYes
sources[].idstringYes
sources[].namestringYes
sources[].kindAppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file")Yes
sources[].linkstring (uri)Yes

Errors

StatusMeaningBody
400

invalid_request or invalid: malformed JSON, unsupported feature, Drive link or tool arguments.

AppAccountError
401

signed_out: missing, unsupported, expired or revoked account credential.

AppAccountError
403

project_role: shared project sources are unavailable; drive_forbidden: Google refused access.

AppAccountError
404

not_found: Connections is disabled for this account/server, the project is absent, the source is absent, or Google cannot find the file.

AppAccountError
409

google_not_connected, google_reconnect, full or ambiguous_name. A revoked refresh grant is marked reconnect for later requests.

AppAccountError
422

invalid_request or tool_failed: Drive validation, missing tool scope, denied policy, unsupported input, or tool execution failure. Tool failures use this status even for a failed downstream read.

AppAccountError
429

rate_limited: the project account service could not complete the request.

AppAccountError
502

google_unavailable or github_unavailable: Google or the project account service could not be reached.

AppAccountError
503

unavailable: connection configuration or account/storage service is unavailable.

AppAccountError

Example

curl 'https://api.openagents.com/v1/connections' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

Disconnect account google

DELETE /v1/connections/google · disconnectAccountGoogle

Delete the local connection before asking Google to revoke its refresh token. Remote revocation is best effort; a successful response proves only local deletion. Existing project sources stay. Repeated removal succeeds with deleted=false. No idempotency key or transaction across Google and local storage is promised.

Sign-in: a bearer credential in the Authorization header.

connectionBearer: A current account sess_ session or oa_sk_ sign-in key. Cookies and oak_ keys are refused. Connections must also be enabled for this account by the Google availability access list; other accounts receive 404 not_found. Google consent and Drive access are additional requirements, never implied by project membership.

Response

200 — The current result.

Type: AppConnectionDeleted

FieldTypeRequiredDescription
objectalways "connection.deleted"Yes
integrationalways "google"Yes
deletedbooleanYes
sources_keptintegerYes

Errors

StatusMeaningBody
400

invalid_request or invalid: malformed JSON, unsupported feature, Drive link or tool arguments.

AppAccountError
401

signed_out: missing, unsupported, expired or revoked account credential.

AppAccountError
403

project_role: shared project sources are unavailable; drive_forbidden: Google refused access.

AppAccountError
404

not_found: Connections is disabled for this account/server, the project is absent, the source is absent, or Google cannot find the file.

AppAccountError
409

google_not_connected, google_reconnect, full or ambiguous_name. A revoked refresh grant is marked reconnect for later requests.

AppAccountError
422

invalid_request or tool_failed: Drive validation, missing tool scope, denied policy, unsupported input, or tool execution failure. Tool failures use this status even for a failed downstream read.

AppAccountError
429

rate_limited: the project account service could not complete the request.

AppAccountError
502

google_unavailable or github_unavailable: Google or the project account service could not be reached.

AppAccountError
503

unavailable: connection configuration or account/storage service is unavailable.

AppAccountError

Example

curl -X DELETE 'https://api.openagents.com/v1/connections/google' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

Browse account drive

GET /v1/connections/google/drive · browseAccountDrive

Browse the caller's own Drive. Folder listing asks Google for up to 50 entries and passes through next as an opaque page token; keep the same folder on subsequent pages. Empty or over-512-byte page values are ignored. q selects a trimmed 1–200-character search, optionally within folder; search ignores page, requests up to 50 matches, and returns next=null. Files and permissions can change between pages; this is not a snapshot.

Sign-in: a bearer credential in the Authorization header.

connectionBearer: A current account sess_ session or oa_sk_ sign-in key. Cookies and oak_ keys are refused. Connections must also be enabled for this account by the Google availability access list; other accounts receive 404 not_found. Google consent and Drive access are additional requirements, never implied by project membership.

Parameters

NameInTypeRequiredDescription
folderquerystringNo
qquerystringNo
pagequerystringNo

Response

200 — The current result.

Type: AppConnectionDrivePage

FieldTypeRequiredDescription
dataarray of AppConnectionDriveFileYes
data[].idstringYes
data[].objectalways "drive_file"Yes
data[].namestringYes
data[].kindAppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file")Yes
data[].folderbooleanYes
data[].linkstring (uri)Yes
data[].modified_atstring or nullYes
folderstringYes
querystring or nullYes
nextstring or nullYes

Errors

StatusMeaningBody
400

invalid_request or invalid: malformed JSON, unsupported feature, Drive link or tool arguments.

AppAccountError
401

signed_out: missing, unsupported, expired or revoked account credential.

AppAccountError
403

project_role: shared project sources are unavailable; drive_forbidden: Google refused access.

AppAccountError
404

not_found: Connections is disabled for this account/server, the project is absent, the source is absent, or Google cannot find the file.

AppAccountError
409

google_not_connected, google_reconnect, full or ambiguous_name. A revoked refresh grant is marked reconnect for later requests.

AppAccountError
422

invalid_request or tool_failed: Drive validation, missing tool scope, denied policy, unsupported input, or tool execution failure. Tool failures use this status even for a failed downstream read.

AppAccountError
429

rate_limited: the project account service could not complete the request.

AppAccountError
502

google_unavailable or github_unavailable: Google or the project account service could not be reached.

AppAccountError
503

unavailable: connection configuration or account/storage service is unavailable.

AppAccountError

Example

curl 'https://api.openagents.com/v1/connections/google/drive' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

Run account drive tool

POST /v1/connections/google/tools/{tool} · runAccountDriveTool

This schema qualifies the Drive tools only. Choose arguments for the named tool: query and optional folder for search; folder and optional page_token for list_folder; file for read. Each call checks the stored grant and policy. Search requests up to 20 matches; list_folder up to 50 with next_page_token. Read may call a model for photos/videos and return usage/cost_usd; it is not a free-read guarantee. Gmail and Calendar tools on this same route have separate contracts.

Sign-in: a bearer credential in the Authorization header.

connectionBearer: A current account sess_ session or oa_sk_ sign-in key. Cookies and oak_ keys are refused. Connections must also be enabled for this account by the Google availability access list; other accounts receive 404 not_found. Google consent and Drive access are additional requirements, never implied by project membership.

Parameters

NameInTypeRequiredDescription
toolpathone of "drive_search", "drive_list_folder", "drive_read", "drive.search", "drive.list_folder", "drive.read"Yes

The source ID or supported Drive tool name.

Request body

Content type: application/json

Type: AppConnectionToolArguments (AppConnectionToolSearch or AppConnectionToolListFolder or AppConnectionToolRead)

Response

200 — The current result.

Type: AppConnectionToolResult

FieldTypeRequiredDescription
resultobjectYes
readarray of objectYes
read[].namestringYes
read[].linkstring (uri)Yes
usageobjectNo
usage.inputintegerYes
usage.outputintegerYes
cost_usdnumberNo

Errors

StatusMeaningBody
400

invalid_request or invalid: malformed JSON, unsupported feature, Drive link or tool arguments.

AppAccountError
401

signed_out: missing, unsupported, expired or revoked account credential.

AppAccountError
403

project_role: shared project sources are unavailable; drive_forbidden: Google refused access.

AppAccountError
404

not_found: Connections is disabled for this account/server, the project is absent, the source is absent, or Google cannot find the file.

AppAccountError
409

google_not_connected, google_reconnect, full or ambiguous_name. A revoked refresh grant is marked reconnect for later requests.

AppAccountError
413

The framework refused an oversized request body.

string
422

invalid_request or tool_failed: Drive validation, missing tool scope, denied policy, unsupported input, or tool execution failure. Tool failures use this status even for a failed downstream read.

AppAccountError
429

rate_limited: the project account service could not complete the request.

AppAccountError
502

google_unavailable or github_unavailable: Google or the project account service could not be reached.

AppAccountError
503

unavailable: connection configuration or account/storage service is unavailable.

AppAccountError

Example

curl -X POST 'https://api.openagents.com/v1/connections/google/tools/{tool}' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "query": "string"
}'

List connected project sources

GET /v1/projects/{id}/sources · listConnectedProjectSources

List the account's own project's stored Drive sources in attachment order. There is no pagination or live Drive permission check. Stored metadata remains visible after disconnect or grant revocation. Shared project members cannot use this source contract.

Sign-in: a bearer credential in the Authorization header.

connectionBearer: A current account sess_ session or oa_sk_ sign-in key. Cookies and oak_ keys are refused. Connections must also be enabled for this account by the Google availability access list; other accounts receive 404 not_found. Google consent and Drive access are additional requirements, never implied by project membership.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Own project ID or name:NAME. Duplicate exact names return 409 ambiguous_name.

Response

200 — The current result.

Type: AppConnectionSources

FieldTypeRequiredDescription
projectstringYes
googleAppConnectionState (one of "connected", "not_connected", "reconnect", "unavailable")Yes
dataarray of AppConnectionSourceYes
data[].idstringYes
data[].objectalways "source"Yes
data[].projectstringYes
data[].integrationalways "google"Yes
data[].namestringYes
data[].kindAppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file")Yes
data[].linkstring (uri)Yes
data[].added_atstring (date-time)Yes

Errors

StatusMeaningBody
400

invalid_request or invalid: malformed JSON, unsupported feature, Drive link or tool arguments.

AppAccountError
401

signed_out: missing, unsupported, expired or revoked account credential.

AppAccountError
403

project_role: shared project sources are unavailable; drive_forbidden: Google refused access.

AppAccountError
404

not_found: Connections is disabled for this account/server, the project is absent, the source is absent, or Google cannot find the file.

AppAccountError
409

google_not_connected, google_reconnect, full or ambiguous_name. A revoked refresh grant is marked reconnect for later requests.

AppAccountError
422

invalid_request or tool_failed: Drive validation, missing tool scope, denied policy, unsupported input, or tool execution failure. Tool failures use this status even for a failed downstream read.

AppAccountError
429

rate_limited: the project account service could not complete the request.

AppAccountError
502

google_unavailable or github_unavailable: Google or the project account service could not be reached.

AppAccountError
503

unavailable: connection configuration or account/storage service is unavailable.

AppAccountError

Example

curl 'https://api.openagents.com/v1/projects/{id}/sources' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

Attach connected project source

POST /v1/projects/{id}/sources · attachConnectedProjectSource

Attach a file or folder after checking it with the caller's own live Drive grant. Only the account's own project is accepted; shared members, including editors, are refused. Up to 20 sources per project and 50 per account. A duplicate returns 200 with the original metadata, name and added_at, even if Drive changed; a new attachment returns 201. A retry checks Drive again, so it can fail after an earlier successful write. No Idempotency-Key handling is offered.

Sign-in: a bearer credential in the Authorization header.

connectionBearer: A current account sess_ session or oa_sk_ sign-in key. Cookies and oak_ keys are refused. Connections must also be enabled for this account by the Google availability access list; other accounts receive 404 not_found. Google consent and Drive access are additional requirements, never implied by project membership.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Own project ID or name:NAME. Duplicate exact names return 409 ambiguous_name.

Request body

Content type: application/json

Type: AppConnectionAttach

FieldTypeRequiredDescription
linkstring or nullNo
idstring or nullNo

Response

200 — The current result.

Type: AppConnectionSource

FieldTypeRequiredDescription
idstringYes
objectalways "source"Yes
projectstringYes
integrationalways "google"Yes
namestringYes
kindAppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file")Yes
linkstring (uri)Yes
added_atstring (date-time)Yes

201 — A new source was attached.

Type: AppConnectionSource

FieldTypeRequiredDescription
idstringYes
objectalways "source"Yes
projectstringYes
integrationalways "google"Yes
namestringYes
kindAppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file")Yes
linkstring (uri)Yes
added_atstring (date-time)Yes

Errors

StatusMeaningBody
400

invalid_request or invalid: malformed JSON, unsupported feature, Drive link or tool arguments.

AppAccountError
401

signed_out: missing, unsupported, expired or revoked account credential.

AppAccountError
403

project_role: shared project sources are unavailable; drive_forbidden: Google refused access.

AppAccountError
404

not_found: Connections is disabled for this account/server, the project is absent, the source is absent, or Google cannot find the file.

AppAccountError
409

google_not_connected, google_reconnect, full or ambiguous_name. A revoked refresh grant is marked reconnect for later requests.

AppAccountError
422

invalid_request or tool_failed: Drive validation, missing tool scope, denied policy, unsupported input, or tool execution failure. Tool failures use this status even for a failed downstream read.

AppAccountError
429

rate_limited: the project account service could not complete the request.

AppAccountError
502

google_unavailable or github_unavailable: Google or the project account service could not be reached.

AppAccountError
503

unavailable: connection configuration or account/storage service is unavailable.

AppAccountError

Example

curl -X POST 'https://api.openagents.com/v1/projects/{id}/sources' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "folder-example-0001"
}'

Detach connected project source

DELETE /v1/projects/{id}/sources/{source} · detachConnectedProjectSource

Remove stored metadata from the account's own project, without deleting or changing the Drive file. A live Google grant is not required. A repeated deletion returns 404. Account/project permission and the Google availability gate still apply.

Sign-in: a bearer credential in the Authorization header.

connectionBearer: A current account sess_ session or oa_sk_ sign-in key. Cookies and oak_ keys are refused. Connections must also be enabled for this account by the Google availability access list; other accounts receive 404 not_found. Google consent and Drive access are additional requirements, never implied by project membership.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Own project ID or name:NAME. Duplicate exact names return 409 ambiguous_name.

sourcepathstringYes

The source ID or supported Drive tool name.

Response

200 — The current result.

Type: AppConnectionSourceDeleted

FieldTypeRequiredDescription
idstringYes
objectalways "source.deleted"Yes
projectstringYes

Errors

StatusMeaningBody
400

invalid_request or invalid: malformed JSON, unsupported feature, Drive link or tool arguments.

AppAccountError
401

signed_out: missing, unsupported, expired or revoked account credential.

AppAccountError
403

project_role: shared project sources are unavailable; drive_forbidden: Google refused access.

AppAccountError
404

not_found: Connections is disabled for this account/server, the project is absent, the source is absent, or Google cannot find the file.

AppAccountError
409

google_not_connected, google_reconnect, full or ambiguous_name. A revoked refresh grant is marked reconnect for later requests.

AppAccountError
422

invalid_request or tool_failed: Drive validation, missing tool scope, denied policy, unsupported input, or tool execution failure. Tool failures use this status even for a failed downstream read.

AppAccountError
429

rate_limited: the project account service could not complete the request.

AppAccountError
502

google_unavailable or github_unavailable: Google or the project account service could not be reached.

AppAccountError
503

unavailable: connection configuration or account/storage service is unavailable.

AppAccountError

Example

curl -X DELETE 'https://api.openagents.com/v1/projects/{id}/sources/{source}' \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"