How to sign a contract

What is a signatory?

A signatory is a user who is authorised to sign on the party's behalf. For example a Director signing on behalf of a company or a letting agent signing on behalf of a landlord. This can be a collaborator or company. More info about this can be found here: https://developers.legislate.tech/reference/legislate-concepts

Steps to sign a contract

  • Create a team that will create the contract
  • Retrieve the contract fields of the contract template
  • Create a contract and provide values for the contract fields
  • Get identity fields for collaborators
  • Add party members or collaborators
  • Sign the contract

Creating a team

Contracts are created in teams. A User can create a new Team or select an existing. In this guide we will create a "New Team to Sign Contract" with the create team endpoint:

curl --request POST \
     --url https://sandbox.legislate.tech/v1/users/{{UserID}}/teams \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer APIKEY' \
     --header 'Content-Type: application/json' \
     --data '
{
     "name": "New team to Sign Contract"

A successful 201 response should return the team ID, an error could mean the name of the team has not been given, or the user ID is incorrect.

{
  "id": {{TeamID}},
  "name": "New team to Sign Contract",
  "created": "2022-06-16 15:16:27.980+0000",
  "_links": {
    "self": {
      "href": "https://sandbox.legislate.tech/v1/teams/{{TeamID}}"
    }
  }
}

Get contract fields

The contract that we use for this does not matter, so we can use any contract. We can look at the list of public contracts we can create using the Get contract type terms of a team (https://developers.legislate.tech/reference/getcontracttypesperteamusingget) which uses the team ID. A successful 204 response should look something like this:

"id": 6690589634461711,
    "name": "Section 8 Notice",
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/teams/6753931778590809/contract-types/6690589634461711"
      },
      {
        "rel": "templates",
        "href": "https://sandbox.legislate.tech/v1/teams/6753931778590809/contract-types/6690589634461711/templates"
      }
    ],
    "about_url": "www.legislate.tech"
  },
  {
    "id": 6690589634461712,
    "name": "Section 21 Notice",
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/teams/6753931778590809/contract-types/6690589634461712"
      },
      {
        "rel": "templates",
        "href": "https://sandbox.legislate.tech/v1/teams/6753931778590809/contract-types/6690589634461712/templates"
      }
    ],
    "about_url": "www.legislate.tech"
  },

Again, as it doesn't matter which contract we use, we can use the NDA contract type. We can use the ID shown to find the Contract template using the Get contract templates endpoint (https://developers.legislate.tech/reference/gettemplatesusingget):

[
  {
    "id": 116,
    "version": "Last updated 13/12/2021",
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/teams/TeamID/contract-types/5938261218295808/templates/116"
      },
      {
        "rel": "type",
        "href": "https://sandbox.legislate.tech/v1/teams/TeamID/contract-types/5938261218295808"
      },
      {
        "rel": "terms",
        "href": "https://sandbox.legislate.tech/v1/templates/116/terms"
      }
    ]
  }
]

This id is the contract template ID. This can be used to get the contract fields, using the Get contract fields endpoint (https://developers.legislate.tech/reference/gettemplatetermsusingget). This endpoint uses the template ID as a parameter and a successful 200 response will look like:

[
  {
    "id": 3009,
    "label": "Name",
    "name": "contract_name",
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/terms/3009"
      }
    ]
  },
  {
    "id": 3010,
    "label": "Please specify the purpose of the Agreement",
    "name": "contract_purpose",
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/terms/3010"
      }
    ]
  },
  {
    "id": 3011,
    "label": "Coverage",
    "name": "contract_coverage",
    "options": [
      {
        "value": "mutual"
      },
      {
        "value": "one way"
      }
    ],
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/terms/3011"
      }
    ]
  },
  {
    "id": 3012,
    "label": "Please specify the Confidentiality Term",
    "name": "contract_confidentialityTerm",
    "options": [
      {
        "value": "2"
      },
      {
        "value": "3"
      },
      {
        "value": "4"
      },
      {
        "value": "5"
      },
      {
        "value": "6"
      },
      {
        "value": "7"
      },
      {
        "value": "8"
      },
      {
        "value": "9"
      },
      {
        "value": "10"
      }
    ],
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/terms/3012"
      }
    ]
  },
  {
    "id": 3013,
    "label": "Effective Date",
    "name": "contract_startDate",
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/terms/3013"
      }
    ]
  },
  {
    "id": 3014,
    "label": "Would the contract creator like to upload their logo to the agreement?",
    "name": "contract_logo",
    "options": [
      {
        "value": "logoYes",
        "nested_fields": [
          {
            "id": 3015,
            "label": "Please upload the logo",
            "name": "contract_logoDetails",
            "links": [
              {
                "rel": "self",
                "href": "https://sandbox.legislate.tech/v1/terms/3015"
              }
            ]
          }
        ]
      },
      {
        "value": "logoNo"
      }
    ],
    "links": [
      {
        "rel": "self",
        "href": "https://sandbox.legislate.tech/v1/terms/3014"
      }

Finding the contract ID

We can find the contract ID by using the Create a contract with an auto-generated bundle endpoint (https://developers.legislate.tech/reference/postcontractusingpost_1-1) using the user ID, team ID and template ID as parameters, as well as filling in all the fields using the response from the Get contract fields endpoint.

curl --request POST \
     --url https://sandbox.legislate.tech/v1/teams/TeamID/contracts \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer API Key' \
     --header 'Content-Type: application/json' \
     --data '
{
     "fields": [
          {
               "id": 3009,
               "name": "Name",
               "value": "New contract for guide"
          }
     ],
     "template_id": 116,
     "created_by_user_id": "UserID"
}

Get Identity Fields

Before creating a collaborator, we need to get the required identity fields for the contract, so we use the Get Identity Fields endpoint (https://developers.legislate.tech/reference/getcollaboratoridentityfieldsusingget)

curl --request GET \
     --url 'https://sandbox.legislate.tech/v1/templates/116/fields?roles=party_with_signatory&side=first' \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer API Key'

Create collaborator given a contract

Using the identity fields we have just gotten, we can create a collaborator with the fields, ContractID, the userID of the collaborator as well as our own user ID:

curl --request POST \
     --url https://sandbox.legislate.tech/v1/contracts/ContractID/collaborators \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer API Key' \
     --header 'Content-Type: application/json' \
     --data '
{
     "role": [
          "party_with_signatory"
     ],
     "email": "email",
     "inviterId": "UserID",
     "side": "first",
     "userId": "UserID+1"
}
'

Upload Signature

Once we have created the collaborator, we should get a CollaboratorID as a response, which we can use in the Upload a Signature endpoint (https://developers.legislate.tech/reference/updatecollaboratorbinaryfilesignatureusingpatch) to upload a signature to sign a contract.