Memos unofficial
POST/api/v1/attachments:upload

Upload an attachment in chunks

Uploads a file in chunks to create an attachment. Start an upload with spec, then use the returned uploadId to continue; each write must use the current committed byte offset. Uploads are bound to the authenticated user, expire after 30 minutes of inactivity, and do not survive a server restart.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

5 body fields

Chunked attachment upload request. Start with spec, then continue with uploadId; writeOffset is required.

specobjectoptional
Starts a new upload. The same call may also carry data and finish_write.
uploadIdstringoptional
Continues the upload identified by a previous response.
writeOffsetstringrequired
Required. Zero-based byte offset at which data is written. Must equal the committed size, except when retrying the most recently accepted chunk with identical bytes and offset, which is accepted without writing again.
datastringoptional
Optional. File bytes, at most max_chunk_size long. With no data and finish_write false, the call reports progress without writing, and write_offset is ignored.
finishWritebooleanoptional
Optional. Finalize the upload after writing data. The committed size must then equal total_size. Any later call for the same upload_id returns the created attachment.

2 status codes
200Returns the upload ID, committed size, maximum chunk size, and the created attachment once the upload is finalized.
uploadIdstringoptional
Opaque ID for subsequent calls. This is not a resource name.
committedSizestringoptional
Number of file bytes committed so far.
attachmentobjectoptional
Set once the upload has been finalized.
maxChunkSizeintegeroptional
Maximum number of data bytes accepted in one call.
defaultReturned when the request fails; includes an error code, a developer-facing message, and optional structured details.
codeintegeroptional
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
messagestringoptional
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
detailsarray<object>optional
A list of messages that carry the error details. There is a common set of message types for APIs to use.

Error handling

writeOffset is required and must equal the committed size, except when retrying the most recently accepted chunk with identical bytes and offset. Start a new upload with spec, whose attachment field is required, and use the returned uploadId for subsequent calls. Each data chunk must not exceed the returned maxChunkSize; when finishWrite is true, the committed size must equal totalSize.