Passer au contenu principal

API - Usecases

Mis à jour il y a plus d’une semaine

QUERIES

Find all templates (you have access to)

Input : None

Output : typeId

query Types {
types {
count
types {
id
name
description
}
}
}

Find all projects (you have access to)

Input : None

Output : contractId

query Contracts {
contracts {
count
contracts {
id
name
status
}
}
}

Find an information on a specific project

Input : contractId

Output : Information you want

query Contract {
contract(id: "4a5cac44-390a-4235-9442-e684a8d21xxx") {
id
name
status
}
}

Find all projects where attribute = "value"

Input : attributeDefinitionId and the value associated

Output : contractId

query Contracts($filters: [ContractFilterInput!]) {
contracts(filters: $filters) {
count
contracts {
id
name
}
}
}

Variables example 2 (find all projects where the counterparty is "My external Company") :

{
"filters": [
{
"attributeDefinitionId": "externalCompanyId",
"value": "4a5cac44-390a-4235-9442-e684a8d21xxx",
"operator": "EQUAL",
"condition": "AND"
}
]
}

Variables example 2 (find all projects where the renewal type is tacit) :

{
"filters": [
{
"attributeDefinitionId": "0144e4a2-75ed-4893-954f-84686eb94xxx",
"value": "tacit",
"operator": "EQUAL",
"condition": "AND"
}
]
}

Find all counterparties

Input : x

Output : externalCompanyId

query ExternalCompanies {
externalCompanies {
count
externalCompanies {
id
name
}
}
}

MUTATION

Create a project

1. createContract

Input : typeID & externalCompany.name

Output : contractId

mutation CreateContract {
createContract(
input: {
externalCompany: { name: "My External Company" }
typeId: "c63b2aad-6650-41f8-adb5-8c572aa12xxx"
}
) {
id
name
}
}

2. createDocument

Input : contractId & templateId

Output : url / key

mutation CreateDocument {
createDocument(
input: {
templateId: "34745518-30c0-4097-b192-51f924258xxx"
contractId: "feceeb15-ff2f-4ab4-a7a4-af411d1a8xxx"
}
) {
id
contractId
version
status
createdAt
}
}

Update project attributes

Input : attributeDefinitionId and the value associated / contractId

Output : x

mutation UpdateContractAttributes {
updateContractAttributes(
input: {
contractAttributes: [
{
attributeDefinitionId: "22363fad-25e8-48e4-a6ee-2cf6b1b90xxx",
value: "Tacit"
},
{
attributeDefinitionId: "e4de6a6b-66f8-4685-aa07-e49e07087836",
value: "Marketing"
},
{
attributeDefinitionId: "startAt",
value: "2025-01-01"
},
],
contractId: "585602c2-97b7-4671-ac37-1f33a2b50xxx"
}
) {
attributeDefinitionId
contractId
value
context
updatedAt
}
}

Add a member to a project

Input : memberID / contractId

Output : x

mutation CreateContractMember {
createContractMember(
contractId: "eec563c3-a652-47e3-999b-b0ec7761axxx"
memberId: "95469046-45d0-4a37-a68a-bc8a6481dxxx"
) {
id
role
}
}

Add a file to a project

1. CreateFileSignedUrl

Input : x

Output : url & key

Nb : Headers returned by this mutation are valid only 30 seconds!

mutation CreateFileSignedUrl {
createFileSignedUrl(contentType: "application/pdf") {
method
url
key
}
}

2. Upload your file on the URL (PUT)

3. AcceptForSignature

Input : file.name, file.contentType & file.key

Output : -

mutation CreateContractFile {
createContractFile(
input: {
contractId: "eec563c3-a652-47e3-999b-b0ec7761axxx"
file: {
name: "Quote.pdf"
contentType: "application/pdf"
key: "signedFiles/392ef54d-dc59-41f6-8ef9-37c6a1b7d353/files/43939e25-df1b-489f-9242-804f6dcd8xxx"
}
}
) {
id
contractId
isFromEmail
}
}

Send for signature

1. AssignSignatoryUser

Input : contractId & signatoryID

Output : -

Nb : must do it as many times as there are signature zones

mutation AssignSignatoryUser {
assignSignatoryUser(
input: {
contractId: "eec563c3-a652-47e3-999b-b0ec7761axxx"
signatoryId: "14db8490-08e0-4238-9626-a1845c166xxx"
email: "testAPI@tomorro.com"
}
) {
id
name
email
title
locationOfSignature
mention
memberId
guestId
type
isBlank
}
}

2. PrepareDocumentForSignature

Input : documentId

Output : -

mutation PrepareDocumentForSignature {
prepareDocumentForSignature(
input: { documentId: "5a5d4fef-179c-4cd5-8606-47568cdb6xxx" }
)
}

3. AcceptForSignature

Input : contractId & documentID

Output : -

mutation AcceptForSignature {
acceptForSignature(
input: {
contractId: "eec563c3-a652-47e3-999b-b0ec7761axxx"
documentId: "5a5d4fef-179c-4cd5-8606-47568cdb6xxx"
}
) {
id
contractId
documentId
type
status
sentAt
signedAt
url
firstSigningParty
}
}

Download signed files

1. Webhook

Create a webhook on Tomorro in order to be notified each time a contract is signed.

Nb : Set up the webhook from an account that has access to all the repository if you want to be notified for all contracts.

Output : contractId

2. signatureByContractId

Input : contractId

Output : fileId

query SignatureByContractId {     
signatureByContractId(contractId: "f614b602-e935-4ef4-95c4-6e2f054d5xxx") {
id
contractId
signatureFiles {
id
file {
id
name
}
}
}
}

3. createFileDownloadSignedUrl

Input : fileId

Output : url / key

mutation CreateFileDownloadSignedUrl {    
createFileDownloadSignedUrl(fileId: "3aad565e-16e6-4124-94d3-8a8b80c9cxxx") {
url
key
}
}

Import counterparty

1. createExternalCompany

Input : None

Output : externalCompanyId

mutation CreateExternalCompany {
createExternalCompany(input: { name: "My External Company" }) {
id
attributes {
externalCompanyId
attributeDefinition {
id
name
}
}
}
}

2. UpdateExternalCompanyAttributes

Input : documentId

Output : -

mutation UpdateExternalCompanyAttributes($input: ExternalCompanyAttributeUpdateInput!) {
updateExternalCompanyAttributes(input: $input) {
externalCompanyId
value
}
}

Variables :

{
"input": {
"externalCompanyId": "52ea33b7-19a8-48e9-a484-009b6a874xxx",
"externalCompanyAttributes": [
{
"attributeDefinitionId": "0144e4a2-75ed-4893-954f-84686eb94xxx",
"value": "498 avenue de Sautie"
},
{
"attributeDefinitionId": "e8b3effb-6722-48cf-b9c6-f6a306a12xxx",
"value": "2025-10-10"
}
]
}
}

Avez-vous trouvé la réponse à votre question ?