OverviewProductsPlatformsAPI ReferenceResources
Files

Create a hosted Google Picker session

POSThttps://zernio.com/api/v1/files/picker-sessions

Creates a hosted Google Picker session so your end user can grant Zernio access to Drive files.

Google accounts are connected with drive.file, so Zernio opens only files it created or the user picked (see the Files tag).

  1. Create a session.
  2. Send the user to url.
  3. They pick files in Google Picker on a Zernio-hosted page.

Authentication

AuthorizationBearer tokenRequired

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

Body

application/json

What every request needs

accountIdstringRequired

A Google account connected with scopes=files.

Optional parameters4 fields
redirectUrlstring (uri), max 2048

Where the browser goes when the user finishes. Absolute http(s) URL or a custom app scheme (myapp://...); relative, protocol-relative and script URLs are refused. Optional when you rely on the file.picked webhook.

fileIdsarray of strings

Drive file ids to show the user first (Google Picker DocsView.setFileIds), for example to ask for access to files your app already knows about. Pre-navigation only: the user still has to pick them.

mimeTypesarray of strings

Only show files of these exact media types.

multiselectbooleanDefault true

false limits the pick to one file.

Responses

Success· the request worked

Errors· the request failed

How it behaves

Redirect

When they finish, the browser is sent to redirectUrl with these query params added (existing params are kept):

  • status=picked, pickerSessionId, fileIds (comma-separated Drive file ids, already checked against Drive), or
  • status=cancelled, pickerSessionId when the user pressed Cancel.

A file.picked webhook fires on every successful pick, so redirectUrl is optional for server-side integrations. Closing the picker without picking keeps the session open; the user can try again until it expires.

Limits

  • The URL is single-use and expires after 30 minutes; create a new session for every pick.
  • Google accounts only: Microsoft accounts answer 400 platform_not_supported because OneDrive needs no picker.
  • Picks are permanent grants: once picked, a file stays readable through the Files endpoints until the user removes Zernio from their Google account.
POST/v1/files/picker-sessions
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.files.createFilePickerSession({  body: {    accountId: 'account_abc123',  },});console.log(data);
{  "data": {    "id": "string",    "url": "http://example.com",    "expiresAt": "2019-08-24T14:15:22Z"  }}
OpenAPI specification
Was this page helpful?