Resources

Documents

Contracts, change orders, estimates, invoices and permits held against a project, plus the workspace's own document library. List and search them across the workspace or down to one project, and download any of them through a signed link that expires.

GET/v1/documents

Search documents

Every project document in the workspace, newest first, each with a signed download link. Requires projects.view on the member who created the API key.

Query parameters

NameTypeDescription
project_iduuidOnly documents on this project. A project in another workspace, or a deleted one, returns 404.
qstringCase-insensitive search over the document name and the original filename. At most 200 characters. Wildcard characters in your text are matched literally.
mime_typestringExact file type, such as application/pdf or image/png.
mime_groupenumimage, pdf, document, spreadsheet or other. A broader filter than mime_type; use one or the other.
folder_iduuidOnly documents filed in this folder.
created_afterdateDocuments created on or after this YYYY-MM-DD date, from midnight UTC.
created_beforedateDocuments created on or before this YYYY-MM-DD date, through the end of that day UTC.
include_company_documentsbooleanSet true to also return the workspace document library. Excluded by default, and cannot be combined with project_id. See the note below.
limitintegerRows per page, 1 to 100. Defaults to 25.
offsetintegerRows to skip. Combine with has_more to page.

The workspace library is opt-in

Coastline keeps two document libraries: the files on each project, and a workspace-wide library for things like signed contracts, onboarding paperwork and report templates. A search of a project's files should never quietly surface the whole workspace library, so this endpoint returns project documents only and you ask for the rest with include_company_documents=true. Documents attached to a contact, a contractor or a team member are not project documents and are not returned by this endpoint at all.

GET/v1/opportunities/{id}/documents

List a project's documents

One project's own documents, newest first, in the same shape as a search result. Always scoped to that project, so the workspace library is never mixed in. Requires projects.view.

It takes the same filters as the search above except project_id and include_company_documents, which are refused here with a message pointing at /v1/documents: the path already names one project, and this endpoint is that project's own library.

NameTypeDescription
qstringCase-insensitive search over the document name and the original filename.
mime_typestringExact file type, such as application/pdf.
mime_groupenumimage, pdf, document, spreadsheet or other.
folder_iduuidOnly documents filed in this folder.
created_afterdateDocuments created on or after this YYYY-MM-DD date, from midnight UTC.
created_beforedateDocuments created on or before this YYYY-MM-DD date, through the end of that day UTC.
limitintegerRows per page, 1 to 100. Defaults to 25.
offsetintegerRows to skip. Combine with has_more to page.

A project that has been archived is still readable: archiving makes it read only, and its signed contracts remain the record. A project outside your workspace, or one that has been deleted, returns 404. To add a document instead, see uploading documents.

GET/v1/documents/{id}

Retrieve a document

One document with freshly signed links. A document in the workspace Trash returns 409 rather than a link: the trash holds a deleted record for 30 days before it is purged, so a link issued for one would work until the purge and then stop. Restore it in Coastline to read it again. A document in another workspace returns 404 and never 403, so the endpoint cannot be used to discover what exists elsewhere.

The document object

FieldTypeDescription
iduuidThe document id.
objectstringAlways document.
project_iduuidThe project it belongs to. Null for a document in the workspace library.
folder_iduuidThe folder it is filed in, if any.
namestringThe name shown in Coastline.
original_namestringThe filename as it was uploaded.
mime_typestringThe file type, used to pick a viewer or an icon.
size_bytesintegerSize of the file.
uploaded_byuuidThe workspace member who added it. Null when nobody is recorded.
created_atstringWhen it was added, ISO 8601.
urls.download.urlstringSigned link to the file. Null only if the file could not be signed; re-fetch to try again.
urls.download.expires_atstringWhen that link stops working.
urls.thumbnail.urlstringSigned link to a preview image. Null when no preview has been made, or the format has none.
urls.thumbnail.expires_atstringWhen the preview link stops working.

Links expire after an hour

Every download link is signed and valid for one hour, and needs no authentication to fetch. Treat one like a password: anyone holding it can read the file until it expires. An hour is deliberately shorter than the day a photo link lasts, because a document is more often a contract, an invoice or signed paperwork.

Store the document id rather than the link, and re-fetch when you need the bytes. Every link carries its own urls.download.expires_at, so you can check before you use one instead of discovering an expired link halfway through a download.

A preview is offered when Coastline has made one, which covers PDFs and images. There is none for other formats, and the field is null rather than an error.

Errors

StatusWhen
400 validation_errorA parameter has the wrong type or an unknown name. The message names the parameter.
401 unauthorizedThe API key is missing or has been revoked.
403 forbiddenThe key's owner does not have projects.view.
404 not_foundThe document or project does not exist in your workspace, or has been deleted.
500 internal_errorSomething went wrong on our end. Retry safe.

See pagination and rate limits before writing a sweep over a workspace, and photos if it is job-site imagery rather than paperwork you are after.