Skip to main content

Overview

After all files have been uploaded to a job, call this endpoint to close the upload window and trigger Plangrep processing. The job transitions through preflighting and then into processing. This endpoint is safe to call multiple times with the same Idempotency-Key — duplicate calls within the idempotency window return the original response without re-triggering processing.
Always supply an Idempotency-Key header when calling this endpoint. If the network request fails or times out, you can safely retry with the same key without risk of double-processing the job.

Endpoint

POST https://plangrep.com/api/open/v1/jobs/{jobId}/uploads/complete

Authentication

All requests must include a Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEY

Path Parameters

jobId
string
required
The unique identifier of the job whose uploads you are completing.

Request Headers

Idempotency-Key
string
An optional client-generated idempotency key (max 256 characters). If a request with this key has already succeeded, the server returns the original response and sets idempotent: true in the body. Use a UUID or other unique value per completion attempt.

Request Body

Content-Type: application/json (optional) The request body is optional. For jobs where files were uploaded via POST /api/open/v1/jobs/{jobId}/files, send an empty object {} or omit the body entirely. For jobs using registered uploads, the body carries completion payloads for each upload mode.
documentIds
string[]
An explicit list of document IDs to include in this completion. When omitted, all documents uploaded to the job are included.
directUploads
array
Completion records for files uploaded via the direct_put flow (registered uploads). Each entry must include:
directUploads[].documentId
string
required
The document ID returned during registration.
directUploads[].uploadToken
string
required
The upload token returned during registration. Proves the direct PUT was performed.
multipartUploads
array
Completion records for files uploaded via the multipart flow (registered uploads). Each entry must include:
multipartUploads[].documentId
string
required
The document ID returned during registration.
multipartUploads[].multipartUploadId
string
required
The multipart upload ID returned during registration.
multipartUploads[].uploadToken
string
required
The upload token returned during registration.
multipartUploads[].parts
array
required
The list of uploaded parts. Each part must include:
parts[].partNumber
integer
required
The 1-based part number matching the registration instructions.
parts[].etag
string
required
The ETag value returned by the storage provider when the part was uploaded.
failedUploads
array
Records of uploads that failed on the client side. Reporting these allows Plangrep to mark the corresponding documents and surface errors in the job result rather than waiting for a timeout.

Response

Status: 202 Accepted
job
object
The updated Job object. Immediately after this call the job status will begin transitioning to preflighting, then processing.
idempotent
boolean
Present and true when the response was served from a previously completed idempotent request. Absent on first-time completions.

Job Status Transitions

uploading → preflighting → processing → complete
                                      ↘ failed
After this endpoint returns 202, poll the job status or use webhooks to detect when processing finishes.

Example Requests

Form Upload Completion (most common)

curl -X POST https://plangrep.com/api/open/v1/jobs/JOB_ID/uploads/complete \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  -d '{}'

Direct PUT Completion

curl -X POST https://plangrep.com/api/open/v1/jobs/JOB_ID/uploads/complete \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  -d '{
    "directUploads": [
      {
        "documentId": "doc_01xyz789",
        "uploadToken": "tok_abc123"
      }
    ]
  }'

Multipart Completion

curl -X POST https://plangrep.com/api/open/v1/jobs/JOB_ID/uploads/complete \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
  -d '{
    "multipartUploads": [
      {
        "documentId": "doc_01xyz789",
        "multipartUploadId": "mpu_def456",
        "uploadToken": "tok_abc123",
        "parts": [
          { "partNumber": 1, "etag": "\"d41d8cd98f00b204e9800998ecf8427e\"" },
          { "partNumber": 2, "etag": "\"7215ee9c7d9dc229d2921a40e899ec5f\"" }
        ]
      }
    ]
  }'

Example Response

{
  "job": {
    "id": "job_01abc123",
    "status": "preflighting"
  }
}

Idempotent Repeat Response

{
  "job": {
    "id": "job_01abc123",
    "status": "processing"
  },
  "idempotent": true
}