Quick start

We suggest you read through the step by step integration guide to understand the integration in detail. Please see below for example code snippets and a postman example.

Before you start
Request your API keys, please let us know if you want to use sandbox or production.

Example code

Below is an example of the full request for creating an envelope.

HintWe suggest you read through the full documentation first.

POST https://api.yotisign.com/v2/envelopes
{
"name": "envelope name",
"emails": {
"invitation": {
"body": {
"message": "Please sign this document"
}
}
},
"recipients": [
{
"name": "User 1",
"email": "user1@test.com",
"role": "CEO",
"auth_type": "no-auth",
"sign_group": 1,
"tags": [
{
"page_number": 1,
"x": 0.1,
"y": 0.1,
"type": "signature",
"optional": false,
"file_name": "myfile.pdf"
}
]
},
const rp = require("request-promise");
const fs = require("fs");

const options = {}; //options object

const createEnvelope = () => {
const request = {
method: "POST",
uri: `<BASE_URL>/v2/envelopes`,
formData: {
file: fs.createReadStream("path/to.pdf"),
options: JSON.stringify(options),
},
headers: {
authorization: "Bearer <API_KEY>",
},
};

return rp(request)
.then((body) => body)
.catch((err) => err);
};

//send request
let result = await createEnvelope();
package com.yoti.sign;

import java.io.File;
import java.io.IOException;
import java.net.URI;

import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

public class Example {

private static final String YOTI_SIGN_AUTH_TOKEN = "<YOUR_AUTH_TOKEN>";
private static final String YOTI_SIGN_BASE_URL = "https://api.yotisign.com/v2";

public static void main(String[] args) {
// Create the client and HttpRequest
<?php

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Request;

use function GuzzleHttp\Psr7\stream_for;

$options = [
'file_name' => 'example-document.pdf',
'name' => 'Sign your request for..',
'emails' => [
'invitation' => [
'body' => [
'message' => 'Please sign the example document',
],
],
],
'recipients' => [
[
'name' => 'John Smith',
'email' => 'example@example.com',
'role' => 'Signee',
'auth_type' => 'no-auth',
'sign_group' => 1,
'tags' => [
[
'page_number' => 1,
using (var pdfFileContent = new StreamContent(
new FileStream(
"test.pdf",
FileMode.Open,
FileAccess.Read)))
{
using (var optionsJsonContent = new StringContent(
optionsJson,
Encoding.UTF8))
{
MultipartFormDataContent multiPartContent = new MultipartFormDataContent
{
{ pdfFileContent, "file", "test.pdf" },
{ optionsJsonContent, "options" }
};

using (HttpRequestMessage request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.yotisign.com/v2/envelopes"),
Content = multiPartContent
})
{
request.Headers.Add("Authorization", "Bearer " + yotiAuthenticationToken);
options := `{}`

payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
_ = writer.WriteField("options", options)
file, err := os.Open("path/to.pdf")
defer file.Close()
formFile, err := writer.CreateFormFile("file",filepath.Base("path/to.pdf"))
_, err = io.Copy(formFile, file)
err = writer.Close()
req, err := http.NewRequest("POST", "<BASE_URL>/v2/envelopes", payload)
req.Header.Add("Authorization", "Bearer <API_KEY>")
req.Header.Add("Content-Type", "multipart/form-data")
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{}
response, err := client.Do(req)

if err != nil {
fmt.Println(err)
} else {
result, _ := ioutil.ReadAll(response.Body)

Web Examples

If you wanna just dive in to hacking this together, click below to see the examples. Otherwise continue with our step by step guide: