NAV
bash javascript

Info

Welcome to the generated API reference.

My Simple Contract API

This is the official documentation of My Simple Contract API. To use the API, you must create an "API Token" from your user account settings. Once generated, a token never expires, so make sure to keep it secret and to delete it from your account when no longer needed. Your API token must be present in all your API requests headers as "Authorization: Bearer {token}".

App : Contracts

Contracts are created for a "partner" using a "template". The "partner" is the person who will sign the contract. The "template" is the model to use for the contract. It contains keywords that will be replaced by the partners fields when generating the contract as a PDF file.

Contracts can be sent for digital signature. You must first initialize the signature process, then send a signature link to the partner, and finally refresh the contract's status to get the signed file. By default, the signature provider is Yousign, unless you decide to configure your own signature provider in your user settings (can be one of Yousign, Universign, Docusign...)

Create Contract


Requires authentication Create a contract for a partner using a template.

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/contract" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"partner_id":8,"template_id":7,"created_at":"libero","sent_at":"est","name":"non","generate":false,"data":[]}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract");

    let params = {
            "groupId": "dolorem",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "partner_id": 8,
    "template_id": 7,
    "created_at": "libero",
    "sent_at": "est",
    "name": "non",
    "generate": false,
    "data": []
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/contract

Body Parameters

Parameter Type Status Description
partner_id integer optional The id of the partner.
template_id integer optional The id of the template.
created_at date optional The creation date of the contract in format "Y-m-d H:i:s".
sent_at date optional A date indicating that the contract has already been sent by email for signature (format "Y-m-d H:i:s").
name string optional The name of the contract.
generate boolean optional Whether the contract PDF file must be generated immediatly. This is used only with "text" templates : you may need to make future textual modifications of the contract after it has been generated from the template. Contracts using "file" templates will generate a PDF file immedialty when created.
data array optional Extra data to use to fill the contract. Make sure the contract's keys correspond to the data keys. When a key already exist for the partner (e.g. "firstname"), its corresponding value will overwrite the partner's value.

Query Parameters

Parameter Status Description
groupId required The id of the contract's group.

Upload Contract


Requires authentication Create a contract for a partner using an existing file (not a template). This is useful for example to import scanned documents already signed in the past.

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/contract/upload" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"created_at":"natus","partner_id":9,"file-0":"sed"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/upload");

    let params = {
            "groupId": "tempore",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "created_at": "natus",
    "partner_id": 9,
    "file-0": "sed"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/contract/upload

Body Parameters

Parameter Type Status Description
created_at date optional The creation date of the contract in format "Y-m-d H:i:s".
partner_id integer optional The id of the partner.
file-0 file optional The file to upload.

Query Parameters

Parameter Status Description
groupId required The id of the contract's group.

List Contracts


Requires authentication List the contracts for a group

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/contract" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"created_at":"est","partner_id":19,"generated":false,"sent":false,"signed":true,"search":"rerum","orderBy":"tempore","orderDir":"officiis","limit":17}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract");

    let params = {
            "groupId": "qui",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "created_at": "est",
    "partner_id": 19,
    "generated": false,
    "sent": false,
    "signed": true,
    "search": "rerum",
    "orderBy": "tempore",
    "orderDir": "officiis",
    "limit": 17
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/contract

Body Parameters

Parameter Type Status Description
created_at date optional The creation date of the contract in format "Y-m-d H:i:s".
partner_id integer optional Filter contracts for a specific partner.
generated boolean optional Filter only generated contracts
sent boolean optional Filter only sent contracts
signed boolean optional Filter only signed contracts
search string optional A string used to filter matching results.
orderBy string optional The partner's field used to sort results.
orderDir string optional Sort direction. Can be "asc" or "desc"
limit integer optional The maximum number of results to return (0 for unlimited).

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Read Contract


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/contract/1" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"eos"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1");

    let params = {
            "groupId": "et",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "eos"
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/contract/{contractId}

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Update Contract


Requires authentication

Example request:

curl -X PUT "http://mysimplecontract.test/api/group/1/contract/1" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"molestiae","created_at":"maxime","sent_at":"odit","signed_at":"eius","name":"non","generate":false}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1");

    let params = {
            "groupId": "enim",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "molestiae",
    "created_at": "maxime",
    "sent_at": "odit",
    "signed_at": "eius",
    "name": "non",
    "generate": false
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/group/{groupId}/contract/{contractId}

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.
created_at date optional The creation date of the contract in format "Y-m-d H:i:s".
sent_at date optional A date indicating that the contract has already been sent by email for signature (format "Y-m-d H:i:s").
signed_at date optional A date indicating that the contract has already been signed (format "Y-m-d H:i:s").
name string optional The name of the contract.
generate boolean optional Whether the contract PDF file should be generated.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Delete Contract


Requires authentication

Example request:

curl -X DELETE "http://mysimplecontract.test/api/group/1/contract/1" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"a"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1");

    let params = {
            "groupId": "omnis",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "a"
}

fetch(url, {
    method: "DELETE",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

DELETE api/group/{groupId}/contract/{contractId}

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Delete Contract


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/contract/1/preview" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"aut"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1/preview");

    let params = {
            "groupId": "repellendus",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "aut"
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/contract/{contractId}/preview

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Generate Contract


Requires authentication Generate the contract PDF file from the template and the partner's fields.

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/contract/1/generate" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"ut"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1/generate");

    let params = {
            "groupId": "quod",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "ut"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/contract/{contractId}/generate

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Download Contract


Requires authentication Download the contract PDF file, if generated. If the contract has already been signed, the signed file is returned.

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/contract/1/download" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"et"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1/download");

    let params = {
            "groupId": "commodi",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "et"
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/contract/{contractId}/download

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Init Contract Signature


Requires authentication

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/contract/1/init-sign" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"non"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1/init-sign");

    let params = {
            "groupId": "ratione",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "non"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/contract/{contractId}/init-sign

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Send Contract for Signature


Requires authentication

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/contract/1/send-sign" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"distinctio"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1/send-sign");

    let params = {
            "groupId": "deleniti",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "distinctio"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/contract/{contractId}/send-sign

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Cancel Contract Signature


Requires authentication

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/contract/1/cancel-sign" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"reiciendis"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1/cancel-sign");

    let params = {
            "groupId": "est",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "reiciendis"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/contract/{contractId}/cancel-sign

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

Refresh Signature Status


Requires authentication

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/contract/1/refresh-sign" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"contractId":"ut"}'
const url = new URL("http://mysimplecontract.test/api/group/1/contract/1/refresh-sign");

    let params = {
            "groupId": "odit",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "contractId": "ut"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/contract/{contractId}/refresh-sign

Body Parameters

Parameter Type Status Description
contractId required optional The id of the contract.

Query Parameters

Parameter Status Description
groupId required The id of the contracts' group.

App : Custom Fields

Custom Fields let you extend the fields associated to the partners within a group. By default, all partners have the following fields defined : firstname, lastname, email, phone. This is the minimum information we need to know so they can sign a contract.

A Custom Field has a name (e.g. "City"), a slug (e.g. "city"), a type (e.g. "text"), a default value (e.g. "Paris"), and an optional set of options. Field's slugs can be used in your templates to locate where the partners values must be written when creating a contract.

List Custom Fields Types


Requires authentication Returns the list of available types for the custom fields. Custom fields use their type to know how they should be formatted when written in contracts. For example, "number" type must be formatted using thousands separator, whereas "date" type must be formatted using the user's country date representation.

Example request:

curl -X GET -G "http://mysimplecontract.test/api/field-types" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/field-types");

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/field-types

Create Custom Field


Requires authentication

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/field" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"name":"quos","slug":"sunt","type":"et","default":"sequi","options":[]}'
const url = new URL("http://mysimplecontract.test/api/group/1/field");

    let params = {
            "groupId": "nihil",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "name": "quos",
    "slug": "sunt",
    "type": "et",
    "default": "sequi",
    "options": []
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/field

Body Parameters

Parameter Type Status Description
name string required The name of the cutom field.
slug string optional The slug that represents the field. If empty or not present in the request, the slug will be generated from the name.
type string required The field's type. Must be one of the available field's types.
default string optional The custom field's default value.
options array optional Available options for the field (only used when the field is of type "select").

Query Parameters

Parameter Status Description
groupId required The id of the custom field's group.

List Custom Fields


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/field" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"limit":19}'
const url = new URL("http://mysimplecontract.test/api/group/1/field");

    let params = {
            "groupId": "voluptatem",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "limit": 19
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/field

Body Parameters

Parameter Type Status Description
limit integer optional The maximum number of results to return (0 for unlimited).

Query Parameters

Parameter Status Description
groupId required The id of the fields' group.

Read Custom Field


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/field/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/field/1");

    let params = {
            "groupId": "eligendi",
            "fieldId": "omnis",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/field/{fieldId}

Query Parameters

Parameter Status Description
groupId required The id of the custom field's group.
fieldId required The id of the custom field.

Update Custom Field


Requires authentication

Example request:

curl -X PUT "http://mysimplecontract.test/api/group/1/field/1" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"name":"molestias","slug":"et","type":"non","default":"quidem","options":[]}'
const url = new URL("http://mysimplecontract.test/api/group/1/field/1");

    let params = {
            "groupId": "in",
            "fieldId": "quis",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "name": "molestias",
    "slug": "et",
    "type": "non",
    "default": "quidem",
    "options": []
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/group/{groupId}/field/{fieldId}

Body Parameters

Parameter Type Status Description
name string optional The name of the cutom field.
slug string optional The slug that represents the field. If empty or not present in the request, the slug will be generated from the name.
type string optional The field's type. Must be one of the available field's types.
default string optional The custom field's default value.
options array optional Available options for the field (only used when the field is of type "select").

Query Parameters

Parameter Status Description
groupId required The id of the custom field's group.
fieldId required The id of the custom field.

Delete Custom Field


Requires authentication

Example request:

curl -X DELETE "http://mysimplecontract.test/api/group/1/field/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/field/1");

    let params = {
            "groupId": "nostrum",
            "fieldId": "voluptatem",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

DELETE api/group/{groupId}/field/{fieldId}

Query Parameters

Parameter Status Description
groupId required The id of the custom field's group.
fieldId required The id of the custom field.

App : Groups

Groups let you separate the different type of partners you may have (the term "partner" refers to "someone who can sign a contract"). For example, depending on your business, you may have "Clients", "Providers" ...

Each group has its own custom fields, templates, and partners. For example, your group "Clients" may define the custom field "Birthday" so that the birthday of your clients can be written in their contracts. Your group "Providers" may define the custom field "Tax ID" so that their tax number ID can be written on their contracts.

Create Group


Requires authentication

Example request:

curl -X POST "http://mysimplecontract.test/api/group" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"name":"voluptatem"}'
const url = new URL("http://mysimplecontract.test/api/group");

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "name": "voluptatem"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group

Body Parameters

Parameter Type Status Description
name string required The name of the group.

List Groups


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"limit":3}'
const url = new URL("http://mysimplecontract.test/api/group");

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "limit": 3
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group

Body Parameters

Parameter Type Status Description
limit integer optional The maximum number of results to return (0 for unlimited).

Read Group


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1");

    let params = {
            "groupId": "consequatur",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}

Query Parameters

Parameter Status Description
groupId optional integer required The id of the group.

Update Group


Requires authentication

Example request:

curl -X PUT "http://mysimplecontract.test/api/group/1" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"name":"dolor"}'
const url = new URL("http://mysimplecontract.test/api/group/1");

    let params = {
            "groupId": "repudiandae",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "name": "dolor"
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/group/{groupId}

Body Parameters

Parameter Type Status Description
name string required The name of the group.

Query Parameters

Parameter Status Description
groupId optional integer required The id of the group.

Delete Group


Requires authentication

Example request:

curl -X DELETE "http://mysimplecontract.test/api/group/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1");

    let params = {
            "groupId": "molestiae",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

DELETE api/group/{groupId}

Query Parameters

Parameter Status Description
groupId optional integer required The id of the group.

App : Partners

Partners are persons who can sign contracts. They belong to a group, and thus can sign contracts generated from templates defined for their group.

Partners have the following fields defined by default : firstname, lastname, email and phone. This is the minimum we need to know so they can sign a contract. "Firstname" and "lastname" are used as their identity, "email" is used to send them signatures links, and "phone" is used to send them security codes at signatures times.

Partners can also have additional attributes corresponding to their group's custom fields. For example : birthday, address, tax id, city...

Create Partner


Requires authentication

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/partner" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"created_at":"aperiam","name":"sed","firstname":"quasi","lastname":"harum","email":"qui","phone":"iusto","extra":[]}'
const url = new URL("http://mysimplecontract.test/api/group/1/partner");

    let params = {
            "groupId": "officia",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "created_at": "aperiam",
    "name": "sed",
    "firstname": "quasi",
    "lastname": "harum",
    "email": "qui",
    "phone": "iusto",
    "extra": []
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/partner

Body Parameters

Parameter Type Status Description
created_at date optional The creation date of the partner in format "Y-m-d H:i:s".
name string optional The name of the partner.
firstname string optional The firstname of the partner.
lastname string optional The lastname of the partner.
email string required The email of the partner.
phone string optional The phone number of the partner.
extra array optional Custom fields values for the partner. The array keys must be slugs of the custom fields defined for the partner's group.

Query Parameters

Parameter Status Description
groupId required The id of the partner's group.

List Partners


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/partner" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"search":"sit","orderBy":"labore","orderDir":"quia","limit":9}'
const url = new URL("http://mysimplecontract.test/api/group/1/partner");

    let params = {
            "groupId": "perspiciatis",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "search": "sit",
    "orderBy": "labore",
    "orderDir": "quia",
    "limit": 9
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/partner

Body Parameters

Parameter Type Status Description
search string optional A string used to filter matching results on all partner's fields.
orderBy string optional The partner's field used to sort results.
orderDir string optional Sort direction. Can be "asc" or "desc"
limit integer optional The maximum number of results to return (0 for unlimited).

Query Parameters

Parameter Status Description
groupId required The id of the partner's group.

Read Partner


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/partner/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/partner/1");

    let params = {
            "groupId": "rem",
            "partnerId": "tempora",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/partner/{partnerId}

Query Parameters

Parameter Status Description
groupId required The id of the partner's group.
partnerId optional integer required The id of the partner.

Update Partner


Requires authentication

Example request:

curl -X PUT "http://mysimplecontract.test/api/group/1/partner/1" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"created_at":"quibusdam","name":"quisquam","firstname":"eos","lastname":"impedit","email":"enim","phone":"incidunt","extra":[]}'
const url = new URL("http://mysimplecontract.test/api/group/1/partner/1");

    let params = {
            "groupId": "nulla",
            "partnerId": "ab",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "created_at": "quibusdam",
    "name": "quisquam",
    "firstname": "eos",
    "lastname": "impedit",
    "email": "enim",
    "phone": "incidunt",
    "extra": []
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/group/{groupId}/partner/{partnerId}

Body Parameters

Parameter Type Status Description
created_at date optional The creation date of the partner in format "Y-m-d H:i:s".
name string optional The name of the partner.
firstname string optional The firstname of the partner.
lastname string optional The lastname of the partner.
email string optional The email of the partner.
phone string optional The phone number of the partner.
extra array optional Custom fields values for the partner. The array keys must be slugs of the custom fields defined for the partner's group.

Query Parameters

Parameter Status Description
groupId required The id of the partner's group.
partnerId optional integer required The id of the partner.

Delete Partner


Requires authentication

Example request:

curl -X DELETE "http://mysimplecontract.test/api/group/1/partner/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/partner/1");

    let params = {
            "groupId": "odio",
            "partnerId": "voluptates",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

DELETE api/group/{groupId}/partner/{partnerId}

Query Parameters

Parameter Status Description
groupId required The id of the partner's group.
partnerId optional integer required The id of the partner.

Export Partners


Requires authentication Export the partners of the group in Excel format. You can filter and sort the results in your request.

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/partner-export" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"search":"numquam","orderBy":"qui","orderDir":"quam","limit":13}'
const url = new URL("http://mysimplecontract.test/api/group/1/partner-export");

    let params = {
            "groupId": "cum",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "search": "numquam",
    "orderBy": "qui",
    "orderDir": "quam",
    "limit": 13
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/partner-export

Body Parameters

Parameter Type Status Description
search string optional A string used to filter matching results on all partner's fields.
orderBy string optional The partner's field used to sort results.
orderDir string optional Sort direction. Can be "asc" or "desc"
limit integer optional The maximum number of results to return.

Query Parameters

Parameter Status Description
groupId required The id of the partner's group.

App : Templates

Templates are the way to define contracts for a group. They contain special "keywords" (or "areas") that will be replaced by the group's partner's fields when generating a contract. Templates belongs to a group, so they can use all the group's Custom Fields as their keywords, and they can be used to generate contracts for all the group's partners.

There are 2 kinds of templates : "text" and "file".

"Text" templates let you edit your contracts' text and insert keywords where suited. The keywords will be replaced by the partner's values at contract creation time (the text will adjust depending on the values length). Keywords use the "mustache" syntax along with Custom Field's slugs : {{ custom_field_slug }}

"File" templates rely on an existing PDF file, so you cannot edit their content. Instead, you can locate on the PDF pages the areas where partners fields should be written. "File" templates are very convenient if your contracts have complex layouts and designs. The downside is that your partner's fields text length might exceed the areas you've defined to write into.

Create Template


Requires authentication Creates a template of type "text". A "text" template must be edited with a text editor (or setting its "content" attribute). The content string can contain keywords like {{ custom_field_slug }} that will be replaced by partner's values when generating a contract for them based on this template.

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/template" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"name":"dolorem"}'
const url = new URL("http://mysimplecontract.test/api/group/1/template");

    let params = {
            "groupId": "sequi",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "name": "dolorem"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/template

Body Parameters

Parameter Type Status Description
name string required The name of the template.

Query Parameters

Parameter Status Description
groupId required The id of the template's group.

Upload Template


Requires authentication Creates a template of type "file". A "file" template uses an existing PDF file as a base. The template "fields" attributes can be used to define where custom fields must be placed on the document. They will be replaced by partner's values when generating a contract for them based on this template.

Example request:

curl -X POST "http://mysimplecontract.test/api/group/1/template/upload" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"file-0":"illum"}'
const url = new URL("http://mysimplecontract.test/api/group/1/template/upload");

    let params = {
            "groupId": "unde",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "file-0": "illum"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

POST api/group/{groupId}/template/upload

Body Parameters

Parameter Type Status Description
file-0 file required The PDF file to use for the template (10 Mo maximum).

Query Parameters

Parameter Status Description
groupId required The id of the template's group.

List Templates


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/template" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"limit":12}'
const url = new URL("http://mysimplecontract.test/api/group/1/template");

    let params = {
            "groupId": "nemo",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "limit": 12
}

fetch(url, {
    method: "GET",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/template

Body Parameters

Parameter Type Status Description
limit integer optional The maximum number of results to return (0 for unlimited).

Query Parameters

Parameter Status Description
groupId required The id of the template' group.

Read Template


Requires authentication

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/template/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/template/1");

    let params = {
            "groupId": "nesciunt",
            "templateId": "porro",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/template/{templateId}

Query Parameters

Parameter Status Description
groupId required The id of the template's group.
templateId required The id of the template.

Update Template


Requires authentication

Example request:

curl -X PUT "http://mysimplecontract.test/api/group/1/template/1" \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{"name":"ullam"}'
const url = new URL("http://mysimplecontract.test/api/group/1/template/1");

    let params = {
            "groupId": "maiores",
            "templateId": "rerum",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
}

let body = {
    "name": "ullam"
}

fetch(url, {
    method: "PUT",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

PUT api/group/{groupId}/template/{templateId}

Body Parameters

Parameter Type Status Description
name string required The name of the template.

Query Parameters

Parameter Status Description
groupId required The id of the template's group.
templateId required The id of the template.

Delete Template


Requires authentication

Example request:

curl -X DELETE "http://mysimplecontract.test/api/group/1/template/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/template/1");

    let params = {
            "groupId": "exercitationem",
            "templateId": "assumenda",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

HTTP Request

DELETE api/group/{groupId}/template/{templateId}

Query Parameters

Parameter Status Description
groupId required The id of the template's group.
templateId required The id of the template.

Preview Template as PDF


Requires authentication Returns the PDF file of the template showing the fields that will be replaced by partner's fields.

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/template/1/preview" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/template/1/preview");

    let params = {
            "groupId": "harum",
            "templateId": "laudantium",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/template/{templateId}/preview

Query Parameters

Parameter Status Description
groupId required The id of the template's group.
templateId required The id of the template.

Preview Template page as JPG


Requires authentication Returns the a JPG file corresponding to the template page number "page"

Example request:

curl -X GET -G "http://mysimplecontract.test/api/group/1/template/1/page-preview/1" \
    -H "Authorization: Bearer {token}"
const url = new URL("http://mysimplecontract.test/api/group/1/template/1/page-preview/1");

    let params = {
            "groupId": "laborum",
            "id": "rem",
            "page": "10",
        };
    Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Authorization": "Bearer {token}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):

{
    "error": "Unauthenticated."
}

HTTP Request

GET api/group/{groupId}/template/{templateId}/page-preview/{pageNum}

Query Parameters

Parameter Status Description
groupId required The id of the template's group.
id optional integer required The id of the template.
page optional integer required The page number to use.