Documents
The PDFs of an envelope: replace a draft's file, download the original or the sealed copy, and check the seal. Sender API key required.
The document object
Attributes
id string
Not empty
name string
sha256 string
SHA-256 of the original file.
Matches ^[0-9a-f]{64}$
pageCount integer
At least 1
pageSizes array of objects
Size of each page in PDF points, in page order.
Attributes of pageSizes
width number
height number
{
"id": "1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048",
"name": "offer.pdf",
"sha256": "1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d",
"pageCount": 1,
"pageSizes": [
{
"width": 595.28,
"height": 841.89
}
]
}Download a PDF
GET/v1/envelopes/{id}/documents/{docId}
The sealed PDF once the envelope is complete, otherwise the original. Ask for one of them with version. A document signed with Aadhaar eSign is the file the eSign provider signed, with the seal added as a further signature and no page added or changed. Its signing certificate and the audit trail are one sealed file of their own, version=certificate, saved under the envelope title, for example "Offer letter (certificate and audit trail).pdf", and the provider's own audit trail, when it was kept, is version=provider-audit-trail.
Auth Sender API key, as Authorization: Bearer <key>
Path parameters
id string Required
The envelope id.
docId string Required
The document id, from documents[].id.
Query parameters
version string
original, sealed (fails with INVALID_STATE until sealing has finished), certificate (fails with INVALID_STATE when the certificate is the last page of the sealed file) or provider-audit-trail (fails with INVALID_STATE when the eSign provider handed over no audit trail).
One of original sealed certificate provider-audit-trail
Returns
200 OK. The PDF file. A string.
Content-Disposition:attachment; filename="<name>-original.pdf"or...-sealed.pdf.
Errors
| Status | When |
|---|---|
| 400 | VALIDATION: the request is malformed. details.issues lists each problem. |
| 401 | UNAUTHORIZED: the API key is missing or not valid. |
| 404 | ENVELOPE_NOT_FOUND, RECIPIENT_NOT_FOUND or NOT_FOUND. |
| 409 | INVALID_STATE: not allowed in the envelope's status (details.status). NOT_YOUR_TURN: sequential routing, an earlier recipient has not acted. CONFLICT: another request changed the envelope, or one with the same Idempotency-Key is still running; try again. |
curl https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048 \
-H "Authorization: Bearer $SIGN_API_KEY" \
-o document.pdfimport { writeFile } from 'node:fs/promises';
import { createSignClient } from '@codevibe_technology/sign-client';
const sign = createSignClient({
baseUrl: 'https://sign.codevibe.in/api',
apiKey: process.env.SIGN_API_KEY!,
});
const pdf = await sign.envelopes.downloadDocument('7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37', '1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048', {
version: 'sealed',
});
await writeFile('sealed.pdf', pdf);import os
import requests
response = requests.get(
"https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048",
headers={
"Authorization": f"Bearer {os.environ['SIGN_API_KEY']}",
},
timeout=30,
)
response.raise_for_status()
with open("document.pdf", "wb") as file:
file.write(response.content)package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SIGN_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
file, err := os.Create("document.pdf")
if err != nil {
panic(err)
}
defer file.Close()
if _, err := io.Copy(file, res.Body); err != nil {
panic(err)
}
fmt.Println(res.Status)
}Content-Type: application/pdf
%PDF-1.7 ... (the PDF bytes)Replace a draft's document
PUT/v1/envelopes/{id}/documents/{docId}
Uploads a new version of one document of a draft, as multipart (document, optional name) or JSON (name, content in base64). Fields stay where they are when their page still exists and they fit on it; the others are moved onto the nearest page and listed in movedFields, so you can check them before sending.
Auth Sender API key, as Authorization: Bearer <key>
Path parameters
id string Required
The envelope id.
docId string Required
The document id, from documents[].id.
Request body
Send it as application/json or multipart/form-data.
name string
At most 200 characters
content string (base64) Required
Returns
200 OK. The draft with the new file, and the fields that were moved. An object.
Errors
| Status | When |
|---|---|
| 400 | VALIDATION: the request is malformed. details.issues lists each problem. |
| 401 | UNAUTHORIZED: the API key is missing or not valid. |
| 403 | FORBIDDEN: the credential may only read. |
| 404 | ENVELOPE_NOT_FOUND, RECIPIENT_NOT_FOUND or NOT_FOUND. |
| 409 | INVALID_STATE: not allowed in the envelope's status (details.status). NOT_YOUR_TURN: sequential routing, an earlier recipient has not acted. CONFLICT: another request changed the envelope, or one with the same Idempotency-Key is still running; try again. |
| 413 | DOCUMENT_TOO_LARGE: a PDF or the whole request is over the limit (details.maxBytes). |
| 422 | DOCUMENT_INVALID: a file is not a readable PDF. PDF_ALREADY_SIGNED: a file already carries digital signatures; upload the unsigned original. REQUIRED_FIELDS_MISSING: required fields were left empty. INVALID_FIELD_VALUE: a value does not suit its field (PNG, date, length). |
curl -X PUT https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048 \
-H "Authorization: Bearer $SIGN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"content": "'"$(base64 < string | tr -d '\n')"'"
}'import { readFile } from 'node:fs/promises';
const response = await fetch('https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.SIGN_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'string',
content: await readFile('string'),
}),
});
console.log(response.status, await response.json());import os
import base64
import requests
def b64(path):
with open(path, "rb") as file:
return base64.b64encode(file.read()).decode()
response = requests.put(
"https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048",
headers={
"Authorization": f"Bearer {os.environ['SIGN_API_KEY']}",
},
json={
"name": "string",
"content": b64("string"),
},
timeout=30,
)
response.raise_for_status()
print(response.json())package main
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
func b64(path string) string {
data, err := os.ReadFile(path)
if err != nil {
panic(err)
}
return base64.StdEncoding.EncodeToString(data)
}
func main() {
payload, err := json.Marshal(map[string]any{
"name": "string",
"content": b64("string"),
})
if err != nil {
panic(err)
}
req, err := http.NewRequest("PUT", "https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048", bytes.NewReader(payload))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SIGN_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(out))
}{
"envelope": {
"id": "string",
"title": "string",
"message": "string",
"changeNote": "string",
"status": "draft",
"routing": "sequential",
"documents": [
{
"id": "string",
"name": "string",
"sha256": "9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c",
"pageCount": 1,
"pageSizes": [
{
"width": 1,
"height": 1
}
]
}
],
"recipients": [
{
"id": "string",
"name": "string",
"email": "asha@example.com",
"phone": "+919876543210",
"role": "signer",
"order": 1,
"auth": "email_link",
"status": "pending",
"declineReason": "string",
"actedAt": "2026-03-02T09:14:31.000Z",
"notifiedAt": "2026-03-02T09:14:31.000Z",
"viewedAt": "2026-03-02T09:14:31.000Z",
"remindersSent": 0,
"lastRemindedAt": "2026-03-02T09:14:31.000Z",
"esign": {
"provider": "leegality",
"status": "pending",
"signerName": "string",
"signedAt": "2026-03-02T09:14:31.000Z",
"ref": "string",
"sandbox": true
}
}
],
"fields": [
{
"id": "string",
"documentId": "string",
"recipientId": "string",
"type": "signature",
"page": 0,
"rect": {
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"required": true,
"label": "string",
"readOnly": true
}
],
"values": [
{
"fieldId": "string",
"value": "string"
}
],
"reminders": {
"firstAfterDays": 0,
"everyDays": 1,
"max": 0
},
"expiresAt": "2026-03-02T09:14:31.000Z",
"createdAt": "2026-03-02T09:14:31.000Z",
"sentAt": "2026-03-02T09:14:31.000Z",
"completedAt": "2026-03-02T09:14:31.000Z",
"metadata": {},
"auditHead": "9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c9f2c"
},
"movedFields": [
"string"
]
}Verify the sealed PDF
GET/v1/envelopes/{id}/documents/{docId}/verification
Runs the seal check on the stored sealed file against the operator certificate and any older certificates the server trusts.
Auth Sender API key, as Authorization: Bearer <key>
Path parameters
id string Required
The envelope id.
docId string Required
The document id, from documents[].id.
Returns
200 OK. The result of the check. A Verification object.
Errors
| Status | When |
|---|---|
| 401 | UNAUTHORIZED: the API key is missing or not valid. |
| 404 | ENVELOPE_NOT_FOUND, RECIPIENT_NOT_FOUND or NOT_FOUND. |
| 409 | INVALID_STATE: not allowed in the envelope's status (details.status). NOT_YOUR_TURN: sequential routing, an earlier recipient has not acted. CONFLICT: another request changed the envelope, or one with the same Idempotency-Key is still running; try again. |
curl https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048/verification \
-H "Authorization: Bearer $SIGN_API_KEY"const response = await fetch('https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048/verification', {
headers: {
Authorization: `Bearer ${process.env.SIGN_API_KEY}`,
},
});
console.log(response.status, await response.json());import os
import requests
response = requests.get(
"https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048/verification",
headers={
"Authorization": f"Bearer {os.environ['SIGN_API_KEY']}",
},
timeout=30,
)
response.raise_for_status()
print(response.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://sign.codevibe.in/api/v1/envelopes/7f3c9a2e-5b1d-4e8a-9c6f-2d4b8e1a0c37/documents/1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048/verification", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SIGN_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status, string(out))
}{
"documentId": "1b8e4f60-2c3a-4d7e-8f91-a5c2e6b3d048",
"valid": true,
"reason": null,
"signer": {
"commonName": "Codevibe Sign Seal"
},
"signedAt": "2026-03-02T09:14:31.000Z",
"certificateSha256": "9f2c1a7b3e4d5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8",
"sha256": "1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d",
"seal": "operator",
"earlierSignatures": []
}