Let's create a document to embed on our website. You can use any document as long as it has embedded_signing
set to true
.
Any of these API endpoints will work with embedding:
The example below is using Create Document from Template. (You can get the ID for any template from the URL when you view that template in the SignWell web app.)
curl --location --request POST 'https://www.signwell.com/api/v1/document_templates/documents/' \
--header 'X-Api-Key: [your api key]' \
--header 'Content-Type: application/json' \
--data-raw '{
"test_mode" : true,
"template_id": "[your template id]",
"embedded_signing": true,
"recipients": [
{
"id": "1",
"placeholder_name": "Contractor",
"name": "Jeremy Neeson",
"email": "[email protected]"
}
]
}'
document_response = HTTParty.post(
"https://www.signwell.com/api/v1/document_templates/documents/",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "[your api key]"
},
body: {
"test_mode": true, #test mode is true for testing
"template_id": "[your template id]",
"embedded_signing": true,
"recipients": [
{
"id": "1",
"placeholder_name": "Contractor",
"name": "Jeremy Neeson",
"email": "[email protected]"
}
]
}.to_json
)
@embedded_signing_url = document_response['recipients'].first['embedded_signing_url']
If you did everything right, you'll get a 200 response with your document details, including the embedded_signing_url
.
{
"id": "c4e4dbd4-4594-43b3-87b0-0b62b10b656b",
"apply_signing_order": false,
"archived": false,
"recipients" : [
{
"id": "1",
"email": "[email protected]",
"name": "Preston Olson",
"embedded_signing_url": "https://www.signwell.com/docs/e600d68a2b/"
}
]
}