Connected sources
Connect Google Drive and attach its files and folders to a project.
| Operation | Request |
|---|---|
| List account connections | GET /v1/connections |
| Disconnect account google | DELETE /v1/connections/google |
| Create google consent link | POST /v1/connections/google/connect |
| Browse account drive | GET /v1/connections/google/drive |
| Run account drive tool | POST /v1/connections/google/tools/{tool} |
| List connected project sources | GET /v1/projects/{id}/sources |
| Attach connected project source | POST /v1/projects/{id}/sources |
| Detach connected project source | DELETE /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
| Field | Type | Required | Description |
|---|---|---|---|
available | boolean | Yes | |
google | AppConnectionGoogle | Yes | |
google.status | AppConnectionState (one of "connected", "not_connected", "reconnect", "unavailable") | Yes | |
google.email | string or null | Yes | |
google.scopes | array of string | Yes | |
google.sheets | boolean | Yes | |
google.features | AppConnectionFeatures | Yes | |
google.features.drive | boolean | Yes | |
google.features.sheets | boolean | Yes | |
google.features.gmail | boolean | Yes | |
google.features.gmail_compose | boolean | Yes | |
google.features.calendar | boolean | Yes | |
google.features.calendar_events | boolean | Yes | |
google.connected_at | string (date-time) or null | Yes | |
connections | array of AppConnectionStored | Yes | |
connections[].integration | string | Yes | |
connections[].name | string | Yes | |
connections[].identity | string or null | Yes | |
connections[].status | AppConnectionState (one of "connected", "not_connected", "reconnect", "unavailable") | Yes | |
connections[].scopes | array of string | Yes | |
connections[].sheets | boolean | Yes | |
connections[].connected_at | string (date-time) | Yes | |
connections[].reconnect | boolean | Yes | |
connections[].tools | array of AppConnectionTool | Yes | |
connections[].tools[].id | string | Yes | |
connections[].tools[].address | string | Yes | |
connections[].tools[].policy | one of "allow", "require_approval", "block" | Yes | |
connections[].tools[].description | string | Yes | |
connections[].tools[].parameters | object | Yes | |
sources | array of object | Yes | |
sources[].project | string | Yes | |
sources[].id | string | Yes | |
sources[].name | string | Yes | |
sources[].kind | AppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file") | Yes | |
sources[].link | string (uri) | Yes |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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
| Field | Type | Required | Description |
|---|---|---|---|
object | always "connection.deleted" | Yes | |
integration | always "google" | Yes | |
deleted | boolean | Yes | |
sources_kept | integer | Yes |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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"
Create google consent link
POST /v1/connections/google/connect · createGoogleConsentLink
Return a browser consent link. Open it signed in as the same account. The finish step checks the account again. This does not automate consent; Google must separately allow the person to connect while app verification is pending.
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.
Request body
Content type: application/json
Type: AppConnectionConnect
| Field | Type | Required | Description |
|---|---|---|---|
sheets | boolean | No | Default: |
feature | one of "drive", "sheets", "gmail", "gmail_compose", "calendar", "calendar_events", null | No | |
return_to | string or null | No | A same-site return path. Unsafe paths fall back to Settings, Connections. |
Response
200 — The current result.
Type: AppConnectionConsent
| Field | Type | Required | Description |
|---|---|---|---|
object | always "connection.consent" | Yes | |
integration | always "google" | Yes | |
url | string (uri) | Yes | |
scopes | array of string | Yes | |
status | AppConnectionState (one of "connected", "not_connected", "reconnect", "unavailable") | Yes | |
message | string | Yes |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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/connect' \
-H "Authorization: Bearer $OPENAGENTS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"sheets": false,
"feature": "drive",
"return_to": "string"
}'
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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
folder | query | string | No | |
q | query | string | No | |
page | query | string | No |
Response
200 — The current result.
Type: AppConnectionDrivePage
| Field | Type | Required | Description |
|---|---|---|---|
data | array of AppConnectionDriveFile | Yes | |
data[].id | string | Yes | |
data[].object | always "drive_file" | Yes | |
data[].name | string | Yes | |
data[].kind | AppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file") | Yes | |
data[].folder | boolean | Yes | |
data[].link | string (uri) | Yes | |
data[].modified_at | string or null | Yes | |
folder | string | Yes | |
query | string or null | Yes | |
next | string or null | Yes |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tool | path | one 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
| Field | Type | Required | Description |
|---|---|---|---|
result | object | Yes | |
read | array of object | Yes | |
read[].name | string | Yes | |
read[].link | string (uri) | Yes | |
usage | object | No | |
usage.input | integer | Yes | |
usage.output | integer | Yes | |
cost_usd | number | No |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | Own project ID or name:NAME. Duplicate exact names return 409 ambiguous_name. |
Response
200 — The current result.
Type: AppConnectionSources
| Field | Type | Required | Description |
|---|---|---|---|
project | string | Yes | |
google | AppConnectionState (one of "connected", "not_connected", "reconnect", "unavailable") | Yes | |
data | array of AppConnectionSource | Yes | |
data[].id | string | Yes | |
data[].object | always "source" | Yes | |
data[].project | string | Yes | |
data[].integration | always "google" | Yes | |
data[].name | string | Yes | |
data[].kind | AppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file") | Yes | |
data[].link | string (uri) | Yes | |
data[].added_at | string (date-time) | Yes |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | Own project ID or name:NAME. Duplicate exact names return 409 ambiguous_name. |
Request body
Content type: application/json
Type: AppConnectionAttach
| Field | Type | Required | Description |
|---|---|---|---|
link | string or null | No | |
id | string or null | No |
Response
200 — The current result.
Type: AppConnectionSource
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
object | always "source" | Yes | |
project | string | Yes | |
integration | always "google" | Yes | |
name | string | Yes | |
kind | AppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file") | Yes | |
link | string (uri) | Yes | |
added_at | string (date-time) | Yes |
201 — A new source was attached.
Type: AppConnectionSource
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
object | always "source" | Yes | |
project | string | Yes | |
integration | always "google" | Yes | |
name | string | Yes | |
kind | AppConnectionKind (one of "folder", "document", "spreadsheet", "presentation", "pdf", "photo", "video", "file") | Yes | |
link | string (uri) | Yes | |
added_at | string (date-time) | Yes |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | Own project ID or name:NAME. Duplicate exact names return 409 ambiguous_name. |
source | path | string | Yes | The source ID or supported Drive tool name. |
Response
200 — The current result.
Type: AppConnectionSourceDeleted
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
object | always "source.deleted" | Yes | |
project | string | Yes |
Errors
| Status | Meaning | Body |
|---|---|---|
| 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"