Skip to main content
POST
/
documents
Create document (Legacy)
curl --request POST \
  --url https://api.firma.dev/functions/v1/signing-request-api/documents \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Sales Agreement 2024",
  "recipients": [
    {
      "name": "John Doe",
      "email": "john@example.com"
    }
  ]
}
'
import requests

url = "https://api.firma.dev/functions/v1/signing-request-api/documents"

payload = {
"name": "Sales Agreement 2024",
"recipients": [
{
"name": "John Doe",
"email": "john@example.com"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Sales Agreement 2024',
recipients: [{name: 'John Doe', email: 'john@example.com'}]
})
};

fetch('https://api.firma.dev/functions/v1/signing-request-api/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.firma.dev/functions/v1/signing-request-api/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Sales Agreement 2024',
'recipients' => [
[
'name' => 'John Doe',
'email' => 'john@example.com'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.firma.dev/functions/v1/signing-request-api/documents"

payload := strings.NewReader("{\n \"name\": \"Sales Agreement 2024\",\n \"recipients\": [\n {\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.firma.dev/functions/v1/signing-request-api/documents")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Sales Agreement 2024\",\n \"recipients\": [\n {\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.firma.dev/functions/v1/signing-request-api/documents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Sales Agreement 2024\",\n \"recipients\": [\n {\n \"name\": \"John Doe\",\n \"email\": \"john@example.com\"\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "description": "<string>",
  "document_url": "<string>",
  "document_url_expires_at": "2023-11-07T05:31:56Z",
  "document_page_count": 2,
  "expiration_hours": 168,
  "settings": {
    "allow_download": true,
    "attach_pdf_on_finish": true,
    "allow_editing_before_sending": false,
    "send_signing_email": true,
    "send_finish_email": true,
    "send_expiration_email": true,
    "send_cancellation_email": true
  },
  "template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "date_created": "2023-11-07T05:31:56Z",
  "date_sent": "2023-11-07T05:31:56Z",
  "date_finished": "2023-11-07T05:31:56Z",
  "date_cancelled": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "certificate": {
    "generated": true,
    "generated_on": "2023-11-07T05:31:56Z",
    "has_error": true
  },
  "final_document_download_url": "<string>"
}
{
"error": "Validation Error",
"message": "Invalid input data",
"details": {
"name": "Name is required",
"email": "Invalid email format"
}
}
{
"error": "Unauthorized",
"message": "Invalid API key"
}
{
"error": "Rate Limit Exceeded",
"message": "Too many requests. Please wait before retrying.",
"details": {
"retry_after": 45
}
}

Authorizations

Authorization
string
header
required

API key for authentication. Use your API key directly without any prefix (e.g., 'your-api-key'). Bearer prefix is optional but not required.

Body

application/json
name
string
required

Document name

Maximum string length: 255
recipients
object[]

Response

Document created successfully

id
string<uuid>

Unique identifier for the signing request

name
string

Signing request name

Maximum string length: 255
description
string | null

Signing request description

document_url
string<uri>

Pre-signed URL to the PDF document. This is a time-limited signed URL for secure access - see document_url_expires_at for expiration time. Initial URLs are valid for 7 days; refreshed URLs are valid for 1 hour. Request a new signing request retrieval to get a fresh URL if expired.

document_url_expires_at
string<date-time> | null

ISO 8601 timestamp when the document_url will expire. After this time, the URL will return an access denied error. Fetch the signing request again to receive a fresh signed URL.

document_page_count
integer

Number of pages in the document

Required range: x >= 1
status
enum<string>

Current status of the signing request

Available options:
not_sent,
in_progress,
finished,
cancelled,
deleted,
expired
expiration_hours
integer
default:168

Hours until signing request expires (default: 168 = 7 days)

Required range: x >= 1
settings
object
template_id
string<uuid> | null

ID of template used to create this signing request

date_created
string<date-time>

Signing request creation timestamp

date_sent
string<date-time> | null

Timestamp when the signing request was sent

date_finished
string<date-time> | null

Timestamp when all signatures were completed

date_cancelled
string<date-time> | null

Timestamp when signing request was cancelled

expires_at
string<date-time> | null

Expiration timestamp

certificate
object | null

Certificate generation status information

final_document_download_url
string<uri> | null

Signed URL to download the final signed document (PDF with certificate). Only available when signing request is finished and certificate has been generated. URL expires after 1 hour.

final_document_download_error
enum<string> | null

Error indicator if the final document exists but could not be accessed. Value is 'file_not_accessible' when the file path exists but the file is missing or inaccessible, otherwise null.

Available options:
file_not_accessible,
null