Skip to content

Access keys and the spreadsheet API

An access key connects a spreadsheet to a website or another program: the program reads sheet rows and ranges, adds and edits data, and manages sheets. The spreadsheet owner issues a key in the Access window, on the API keys tab. A key opens one spreadsheet and only what it has been allowed to do. This page covers keys and reading; writing is described in Writing to a spreadsheet with a key. For a local copy, see Workbook changes via the API; for several writes in one request, see Batch writes with the workbook API; to filter, sort and choose returned columns, see Querying rows with the API; for columns, sheet copies, named ranges, formats and validation, see Workbook editor operations via the API. See also file jobs and the TypeScript and Python clients.

  1. In the spreadsheet, click Access and open the API keys tab (next to People; the left and right arrow keys also switch tabs). At the top is API address with the Copy address icon and the API guide icon, which opens this guide in a new tab.
  2. Click New key. Name is how the key is labelled in the list, in cell history and in notifications: Key “Website”.
  3. Rights: click one or more tiles: Read, Add rows, Edit cells, Rows and sheets (deleting rows; creating, renaming and deleting sheets).
  4. Sheets: All sheets or Selected, with a checkbox for each sheet. The key does not see hidden sheets.
  5. If Add rows is the only right selected, Websites and Rows per day appear: this is a key for a website form (how to connect a form). In Websites, enter addresses such as https://multron.kz, separated by spaces or commas. Rows per day is from 1 to 100,000; an empty field means 1000 when websites are listed and no limit without websites.
  6. Expires: Never (selected at first), 30 days, 90 days or 1 year.
  7. The Requests block shows right away which requests the key will open. Click Create key.
  8. The key appears in the Key “…” field, marked Shown only now. Below it is Example: a ready-made command for the first request with this key and the API address (for a key with Read, the sheet rows; for the others, information about the spreadsheet); the Copy example icon copies it. Save the key with the Copy icon and click Hide key: it cannot be shown again. If you lose it, issue a new key and revoke the old one.

Each key in the list shows its rights, sheets, websites, expiry (Until … or Expired) and Used … or Not used. The trash icon Revoke key “…” turns the key off immediately, without confirmation.

The API address is https://api.duoshao.org/v1; the former https://sheet.duoshao.org/api/v1 works the same way. The key is sent in the Authorization: Bearer dsk_… header; responses are JSON. The full machine-readable description of all requests (OpenAPI 3.1) is at GET https://api.duoshao.org/v1/openapi.json, with no key: client generators and Postman understand it.

Окно терминала
KEY=dsk_… # key from "API keys"
BASE=https://api.duoshao.org/v1
curl -H "Authorization: Bearer $KEY" $BASE/workbook
{"workbook":{"id":"…","title":"Catalog","revision":412,"updatedAt":"2026-11-13T10:32:05.000Z"},
"key":{"name":"Website","rights":["read","write"],"expiresAt":null},
"sheets":[{"id":"…","title":"Products","rows":1000,"cols":26}]}

/workbook answers any valid key: the spreadsheet, the key and the sheets the key can see. The other requests need the sheet id. Rights in the response: read, append, write, structure.

Окно терминала
SHEET=… # sheet id from /workbook
curl -H "Authorization: Bearer $KEY" "$BASE/sheets/$SHEET/rows?headerRow=1&offset=0&limit=5000"
{"revision":412,"sheet":{"id":"…","title":"Products"},"header":["SKU","Name","Photo","Price"],
"rows":[{"row":2,"cells":[{"value":"MLT-1"},{"value":"Buy","link":"https://…"},
{"images":[{"id":"…","mime":"image/webp","width":800,"height":600,"size":51234,"name":"hub.png"}]},{"value":1500,"text":"1 500.00 ₽"}]},
{"row":4,"cells":[{"value":"MLT-2"},null,null,null]}],"next":null}
  • header is the text of the header row headerRow (row 1 by default), with empty columns on the right dropped. Row cells follow the header width; cells further right are not returned.
  • row is the row number as in the spreadsheet. Completely empty rows are skipped, so a page can be shorter than limit.
  • A cell: value is the result for a formula, true/false for a checkbox, the chosen option for a dropdown; text is how a number looks on screen (date, currency, percent) when it differs from the value; error is a formula error such as "#DIV/0!"; link is a link; images are photos; an empty cell is null.
  • next is the offset of the next page; null means there is no data below. Keep reading until next is null: a page can come back empty while next is not empty.
  • To keep pages on the same revision, pass the first response’s revision on every later page along with next, for example ?offset=1&limit=1&revision=412. If it no longer matches, the server returns 409 revision_conflict; restart from the first page and do not mix pages. The optional revision parameter also works for values reads. It must appear once as a canonical decimal integer from 0 to 9007199254740991, with no leading zeroes; an invalid or repeated value returns 400 invalid_request.
  • The response carries an ETag for the workbook revision, such as "412"; under compression it can be weak, W/"412". For row, range and photo requests, If-None-Match accepts either form, a list of tags, or *. The server checks access first and, for row and range reads, checks a supplied revision before the ETag condition. A match returns 304 with no body.

Row filter: the filter parameter, a JSON object “column → value or list of values”. Rows that meet all the conditions remain; for a list, any one of its values is enough. A value matches exactly (case-sensitive) either the cell value itself or its text on screen: the number 1500 is found as 1500, as "1500" and as "1 500.00 ₽"; a checkbox is true/false; null is an empty cell. A column is looked up ignoring case and spaces at the edges.

Окно терминала
curl -G -H "Authorization: Bearer $KEY" "$BASE/sheets/$SHEET/rows" \
--data-urlencode 'filter={"Status":["New","In progress"],"Paid":true}'
{"revision":412,"sheet":{"id":"…","title":"Orders"},"header":["Number","Status","Price","Paid"],
"rows":[{"row":2,"cells":[{"value":1001},{"value":"New"},{"value":1500,"text":"1 500.00 ₽"},{"value":true}]}],"next":null}

The filter works within a page: next is counted by sheet rows, just as without a filter, so a filtered page can be empty while next is not empty: keep reading.

range is a cell (C2) or a rectangle (A1:D20); a rectangle that goes beyond the sheet is cut to the sheet. render: value (the default) gives values, the result for a formula, and an error as an object; text gives what is on screen, an empty cell is ""; formula gives the formula text for cells with a formula and the value for the others.

Окно терминала
curl -H "Authorization: Bearer $KEY" "$BASE/sheets/$SHEET/values?range=A1:D3"
{"revision":412,"sheet":{"id":"…","title":"Calculation"},"range":"A1:D3",
"values":[["Price","Qty","Total","Date"],[1500,3,4500,45900],["=not a formula",true,{"error":"#DIV/0!"},null]]}
Окно терминала
curl -H "Authorization: Bearer $KEY" "$BASE/sheets/$SHEET/values?range=A2:D2&render=text" # [["1 500.00 ₽","3","4500","2025-08-31"]]
curl -H "Authorization: Bearer $KEY" "$BASE/sheets/$SHEET/values?range=A2:C2&render=formula" # [[1500,3,"=A2*B2"]]

This response also carries ETag and understands If-None-Match.

The id comes from the cell’s images: curl -H "Authorization: Bearer $KEY" -o photo.webp $BASE/images/<id>. A photo is available only while it is currently referenced by at least one visible grid sheet that the key can access in the same workbook and organization. Unknown, unattached, or hidden-only photos return 404; a key without Read gets 403. The response contains the photo bytes and type. It has Cache-Control: private, no-cache and Vary: Authorization. The server checks access before checking ETag; an allowed photo with a matching If-None-Match returns 304.

import requests
BASE = "https://api.duoshao.org/v1"
session = requests.Session()
session.headers["Authorization"] = "Bearer dsk_…"
def all_rows(sheet_id, **params):
offset = 0
revision = None
while offset is not None:
page_params = {**params, "offset": offset}
if revision is not None:
page_params["revision"] = revision
page = session.get(f"{BASE}/sheets/{sheet_id}/rows", params=page_params, timeout=30)
page.raise_for_status()
body = page.json()
if revision is None:
revision = body["revision"]
yield from body["rows"]
offset = body["next"] # None means there is no data below
for row in all_rows("SHEET_ID", filter='{"Status":"New"}'):
print(row["row"], [cell and cell.get("value") for cell in row["cells"]])
  • Only the spreadsheet owner issues and revokes keys; only the owner sees the People and API keys tabs. Up to 10 active keys per spreadsheet; an expired key takes a place until it is revoked.
  • A key name is up to 60 characters, up to 10 websites, up to 50 selected sheets, Rows per day up to 100,000 (counted over the last 24 hours).
  • Rows: up to 5000 per page and no more than 250,000 cells; filter: up to 10 columns and up to 50 values per column. Range: up to 250,000 cells.
  • Rate: 600 requests per minute per key; from a browser, also 30 per minute per key from one address.
  • From a browser you can only add rows, with a key that has websites; reading only from your own server.
  • A key does not see comments, history, members or access. For formats, named ranges and validation, use the editor API.

An API error looks like this: {"error":"code","message":"…"}. The text follows the Accept-Language header (Russian by default, English, Chinese). With 429 and 503, the Retry-After header says after how many seconds to retry. Write errors are in Writing to a spreadsheet with a key.

Each /workbook, rows, values and image read uses one committed workbook state. If the server cannot establish a coherent read after three attempts, it returns 503 unavailable with Retry-After: 1.

What you see Why What to do
No more than 10 keys: revoke one you don’t need The spreadsheet has 10 active keys Revoke an unneeded or expired key
A website is an https:// address without a path: … The website has a path, no https, or a typo Only the website address: https://multron.kz
Couldn’t load keys Connection failure Retry
Couldn’t create the key, Couldn’t revoke the key Connection failure or the spreadsheet is unavailable Try again later
400 invalid_request Wrong headerRow, offset, limit, render or revision; revision is repeated or not a canonical decimal; no range; filter is not a JSON object, is empty, has more than 10 columns or 50 values, or a nested value Compare the request with the examples
401 unauthorized No key, or it was revoked or has expired Issue a new key
403 forbidden The key lacks the needed right Issue a key with this right
403 browser_denied, 403 origin_denied A browser call with a key without websites, not for adding rows, or from a website not on the list Read from your own server
404 not_found The sheet is not in the key, is hidden or deleted; a photo is unknown, unattached, linked only from a hidden or inaccessible sheet, or from another workbook or organization Take sheets from /workbook; use a photo still linked from a visible sheet the key can access
409 revision_conflict A pinned rows or values read no longer matches the workbook revision Start the read again from the first page; do not combine pages from different revisions
413 too_large The range is larger than 250,000 cells Read in parts
422 unknown_column, 422 ambiguous_column filter has a column that does not exist or appears twice; the response has column Check the headers and headerRow
422 invalid_range The address is not of the form A1 or A1:D20 (a sheet name is not allowed) or starts beyond the sheet Fix range
429 rate_limited More than 600 requests per minute Wait for Retry-After
503 unavailable The server is restarting, temporarily read-only, or could not get a coherent workbook read after three attempts Retry after the Retry-After delay (one second for a coherence failure)