Managing Organizations and Clients
Intro

Clients are required for making and sending documents and so are one of the first things you should create in the MakeLeaps app.

All requests to the Client API require authorization. For more, see this post on the basics of Managing Authentication in Makeleaps.

Below are some examples of basic basic usage of the Client API. For a more detailed specification, please see theClient Oragnization section of our API Reference.

Creation

Basic Client and Org creation. The script to the right will create a client named Taro under the Organization name Example Co

Python
HTTP
data = json.dumps({
    "client_external_id": "CLIENT-12345",
    "contacts": [
        {
            "contact_type": "organization",
            "name": "Example Co",
            "addresses": [],
            "email": None,
        }, {
            "contact_type": "person",
            "family_name": "Taro",
            "addresses": [],
            "email": {"address": "taro@example.com"},
        }],
})

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

requests.post("https://api.makeleaps.com/api/partner/{ partner_mid }/client/", data=data, headers=headers)
POST /api/partner/0000000000000000000/client/ HTTP/1.1
Host: api.makeleaps.com
User-Agent: python-requests/2.21.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Content-Length: 253

{"client_external_id": "CLIENT-12345", "contacts": [{"contact_type": "organization", "name": "Example Co", "addresses": [], "email": null}, {"contact_type": "person", "family_name": "Sato", "addresses": [], "email": {"address": "sato@example.com"}}]}
Modifying

This script will modify existing clients

Python
HTTP
data = {"default_client": "https://api.makeleaps.com/api/partner/{ mid }/client/{ client_mid }/"}

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

requests.patch("https://api.makeleaps.com/api/partner/{ partner_mid }/client/", data=data, headers=headers)
PATCH /api/partner/0000000000000000000/client/0000000000000000000/ HTTP/1.1
Host: api.makeleaps.com
User-Agent: python-requests/2.21.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Content-Length: 28

{"default_client": "https://api.makeleaps.com/api/partner/{ mid }/client/{ client_mid }/"}
Deletion

Deleting those same clients.

Python
HTTP
headers = {
    "Authorization": "Bearer { token }"
}

requests.delete("https://api.makeleaps.com/api/partner/{ mid }/client/{ client_mid }/", headers=headers)
DELETE /api/partner/0000000000000000000/client/0000000000000000000/ HTTP/1.1
Host: api.makeleaps.com
User-Agent: python-requests/2.21.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Content-Length: 0