Collection requests and file sharing — API quick start
1. Create a scoped credential
Sign in as the installation Administrator and open Developer / API. Select operation scopes, enabled record types and optional record IDs. Copy the key once and store it in your server’s secret manager. Use a separate credential for each installation and integration.
This is an explicit Administrator delegation to the installation’s background integration. The API checks the current local role policy and uses the trusted NetSuite callback to verify each target record. Production, Sandbox and Release Preview remain separate.
2. Create a request
Use a requests:create credential to GET /v1/integrations/document-categories with installationId, recordType and saved recordId. This retains collection creation permissions and plan checks. The response contains categories with id and name; an empty list means an administrator must configure an applicable category first.
Query once during integration setup, select at least one category UUID and save it in your configuration. Reuse those IDs without querying before every request. Refresh if a category is removed, disabled or stops applying to the target record type. Category UUIDs differ from attachment box UUIDs and NetSuite field script IDs.
Save the following as request.json and replace placeholders. Expiry must be in the future and within 90 days. Use an 8–128 character printable idempotency key for each new request; keep the same payload and key when retrying. Empty category IDs are invalid. Automated uploads use separate credentials.
{
"target": {
"installationId": "<installation UUID>",
"recordType": "PURCHASE_ORDER",
"recordId": "<saved record internal ID>"
},
"title": "Please submit supporting documents",
"message": "Submit the requested documents using this secure link.",
"recipientEmail": "recipient@example.com",
"requestedCategoryIds": [
"<category UUID>"
],
"expiresAt": "<future ISO 8601 UTC timestamp within 90 days>",
"maximumFiles": 10,
"maximumBytes": 104857600,
"requireEmailOtp": true,
"uploadOnly": true,
"allowViewOwnUploads": true
}curl "$DOCLAYER_ORIGIN/v1/integrations/upload-requests" \ -H "Authorization: Bearer $DOCLAYER_API_KEY" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: collection-order-20261010-001' \ --data @request.json
The response contains id, url, expiresAt, invitationStatus and replayed. The specified recipient receives an invitation automatically and opens its private email link without another code. Copied response links retain email verification. Files are uploaded directly to private storage and become available only after verification and malware scanning.
3. Query submissions
GET /v1/integrations/upload-requests/{id} requires installationId, recordType and recordId as query parameters. Requests are scoped to the exact record and creating credential. The files array reports processing states; AVAILABLE means the file can be used in the record workspace.
List requests with the same target parameters. Use limit and the returned nextCursor for pagination. DELETE revokes a request. POST to /{id}/link regenerates its link and requires Idempotency-Key.
Automate uploads to a saved NetSuite record
In Developer / API, select the allowed record types and one upload destination. Optionally restrict the key to saved internal record IDs. Create a separate key for each service and store it on that service’s server.
- Select Automated uploads to Other attachments (uploads:record) to attach a file to the record itself. Omit attachmentFieldId from every call.
- Select Automated uploads to attachment boxes (uploads:create) and grant verified boxes. Send the selected box’s DocLayer UUID as attachmentFieldId on every call.
- For an attachment box, GET /v1/integrations/attachment-fields with installationId, recordType and recordId as query parameters and the same Bearer key. Select an attachmentFieldId from the enabled, verified boxes returned for that record.
- POST /v1/integrations/uploads with an Idempotency-Key, a target containing installationId, recordType and recordId. Add attachmentFieldId for a box upload. Include the filename, MIME type, byte count and SHA-256. Keep the upload session ID and reuse the same key and payload if the response is lost.
- POST to the session’s /authorization with the same target. If AUTHORIZED, PUT the original file directly to the returned URL with the specified headers. Keep signed URLs private and send the DocLayer API key only to DocLayer.
- If the transfer result is unknown, call /authorization again. PRESENT means the object is present. WAIT provides the deadline for the outstanding authorization. After a concurrent authorization conflict, read the session status and reconcile.
- POST to the session’s /complete with the same target. GET the session with the target fields as query parameters to read transfer, availability and nativeSync. Wait for AVAILABLE and check the SHA-256. For Other attachments, nativeSync is null.
For DOCUMENT_ACCESS_DENIED (403), check the key’s destination scope, expiry and revocation, exact installation/type/record grant and selected box UUID if applicable. The installation must retain API access, upload permission and a working background connection to that record. For support, retain the requestId, timestamp, non-secret target and credential name. Never send the key, Authorization header or signed URLs.
Automated uploads create new documents and use the single-file transfer limit shown by your installation’s upload policy. Revoking a key denies further API calls. A storage URL already issued remains valid until its expiry.
Share an existing file
Select shares:create, shares:read, shares:revoke and shares:rotate when creating a credential. Existing collection credentials do not gain these scopes automatically. Sharing requires the installation’s api_access and sharing features, an accessible saved record, and an available, verified and scanned document version. Creating a downloadable share also requires download permission.
Use a shares:create credential to list the record’s DocLayer files. The response includes ordinary attachments (attachmentField is null) and attachments in fields (attachmentField contains the box ID, name and enabled state). Pass nextCursor as cursor with the same record parameters to read the next page. Use the selected file’s id as documentId and check that its currentVersion is AVAILABLE before sharing it.
GET /v1/integrations/documents?installationId=<UUID>&recordType=PURCHASE_ORDER&recordId=123 Authorization: Bearer <integration key>
POST /v1/integrations/documents/{documentId}/shares
Authorization: Bearer <integration key>
Idempotency-Key: share-order-001
Content-Type: application/json
{
"target": { "installationId": "<UUID>", "recordType": "PURCHASE_ORDER", "recordId": "123" },
"expiresAt": "<future ISO 8601 UTC timestamp>",
"allowDownload": true
}The example creates a link without a password. For a protected link, add a password string of 1–128 characters. Empty strings and null return 400. Omit unused optional fields such as emailRestriction and versionId. The response returns the unique /s/ URL once. Open it to download the file, or enter the password first if one was set. Effective expiry must be within 365 days. Use allowDownload: false for preview access; preview does not prevent saving or screenshots. An optional maximumDownloads limits new download authorizations.
GET the same route to list shares. GET or DELETE /{shareId} reads or revokes one. POST /{shareId}/link regenerates the URL with a new Idempotency-Key. These operations require installationId, recordType and recordId as query parameters. Read/list responses contain policy, status and counters, never URL tokens or passwords. Regeneration preserves password, expiry, pinned version and download count while invalidating the previous URL. API credentials manage only the shares they created; authorized workspace users can manage all shares for that file and record.
Revoking an API key does not revoke its existing shares. Revoke those links separately. Existing storage access expires within 30 seconds; copies already downloaded cannot be recalled. Neither link rotation nor version updates extend the selected version or expiry.
Retries, errors and limits
400: check the payload and Idempotency-Key. 403: check credential scopes, record access and installation policy. 409 IDEMPOTENCY_KEY_REUSED: use the original payload or a new key. 429: honor Retry-After. Retry a transport failure or 5xx with the same key and unchanged payload.
Invitation status is independent of request creation. FAILED means the request exists and its returned link can still be shared with the specified recipient. Regenerated links are not emailed automatically. Revoking an API key stops future integration calls; separately revoke its collection requests to stop guest submissions.
Maximum file size is the lower of tenant policy and the deployment’s verified processing capacity. A request’s total byte limit does not increase the per-file limit. Initial processing capacity remains 100 MiB. Automated uploads target verified DocLayer attachment boxes on saved NetSuite records.
JavaScript and Python
const response = await fetch(process.env.DOCLAYER_ORIGIN + '/v1/integrations/upload-requests', {
method: 'POST',
headers: { Authorization: 'Bearer ' + process.env.DOCLAYER_API_KEY,
'Content-Type': 'application/json', 'Idempotency-Key': operationKey },
body: JSON.stringify(request)
});
if (!response.ok) throw new Error('Request failed: ' + response.status);
const result = await response.json();import os, requests
response = requests.post(os.environ['DOCLAYER_ORIGIN'] + '/v1/integrations/upload-requests',
headers={'Authorization': 'Bearer ' + os.environ['DOCLAYER_API_KEY'],
'Idempotency-Key': operation_key}, json=request_body, timeout=30)
response.raise_for_status()
result = response.json()API version: /v1. First collection-integration release: 2026-10-10. Examples apply to any supported, enabled record type, including registered custom record types.