NAV Navigation
Shell HTTP JavaScript Ruby Python PHP Java Go

Documents API v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Email: Support

Authentication

Purchase Agreements

A purchase agreement is a legal document that customers are required to review and sign before buying certain membership contracts and credit packages.

List users with pending purchase agreement signatures.

Code samples

# You can also use wget
curl -X GET /api/documents/v1/pending_purchase_agreement_signatures \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

GET /api/documents/v1/pending_purchase_agreement_signatures HTTP/1.1

Accept: application/json


const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/pending_purchase_agreement_signatures',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/api/documents/v1/pending_purchase_agreement_signatures',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/documents/v1/pending_purchase_agreement_signatures', headers = headers)

print(r.json())

 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/api/documents/v1/pending_purchase_agreement_signatures', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/pending_purchase_agreement_signatures");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/documents/v1/pending_purchase_agreement_signatures", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /api/documents/v1/pending_purchase_agreement_signatures

View a list of users who need to sign purchase agreements for products in their recently modified, open carts. Available filters are cart_id, customer_email, customer_id, is_for_studio_cart, and location_id.

Parameters

Name In Type Required Description
cart_id query string false Filter pending signatures by the ID of the relevant cart.
customer_email query string(email) false Filter pending signatures by the email of the relevant user.
customer_id query string false Filter pending signatures by the ID of the relevant user.
is_for_studio_cart query boolean false Filter pending signatures according to where the relevant cart was created. Filtering by is_for_studio_cart=true will return pending signatures for carts created in studio. Filtering by is_for_studio_cart=false will return signatures for carts created in customer-facing applications, like the client's website or mobile apps.
location_id query string false Filter pending signatures by the ID of the location where the relevant product is being purchased.

Example responses

200 Response

{
  "results": [
    {
      "customer_id": "123",
      "customer_email": "wednesday@marianatek.com",
      "customer_name": "Wednesday Addams",
      "pending_signatures": [
        {
          "cart_line_id": "123",
          "location_id": "123",
          "location_name": "Capitol Hill",
          "product_id": "123",
          "product_name": "Premium Monthly Membership",
          "purchase_agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
          "purchase_agreement_name": "Monthly Membership Agreement",
          "purchase_agreement_requirement_id": "2939da5b-357b-4c0f-91b1-95f257d62c7a",
          "purchase_agreement_url": "https://{BRAND}.marianatek.com/api/documents/v1/pending_purchase_agreement_signatures/9ad4b700-5f8b-4d2c-b2b5-e7b885a90b17/pending_agreement_text?agreement_id=61a995e3-b484-485a-9799-b873a93e83c6"
        }
      ]
    }
  ],
  "meta": {
    "pagination": {
      "count": 15,
      "pages": 2,
      "page": 1
    }
  }
}

Responses

Status Meaning Description Schema
200 OK Success. UsersWithPendingSignaturesList
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
503 Service Unavailable The server is temporarily unable to handle this request. None

List purchase agreements

Code samples

# You can also use wget
curl -X GET /api/documents/v1/purchase_agreements \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

GET /api/documents/v1/purchase_agreements HTTP/1.1

Accept: application/json


const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/purchase_agreements',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/api/documents/v1/purchase_agreements',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/documents/v1/purchase_agreements', headers = headers)

print(r.json())

 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/api/documents/v1/purchase_agreements', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/purchase_agreements");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/documents/v1/purchase_agreements", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /api/documents/v1/purchase_agreements

View all purchase agreements. Can be filtered by is_active, location_id, required_for_location_id, and required_for_product_id.

Parameters

Name In Type Required Description
is_active query boolean false Filter purchase agreements by whether they are active (is_active=true) or inactive (is_active=false).
location_id query string false Filter purchase agreements by the ID of a location where they are available, i.e. where they can be required for products.
required_for_location_id query string false Filter purchase agreements by the ID of a location where they are required for the purchase of one or more products.
required_for_product_id query string false Filter purchase agreements by the ID of a product for which they are required.

Example responses

200 Response

{
  "results": [
    {
      "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "created_by": "123",
      "is_active": true,
      "name": "Monthly Membership Agreement",
      "text": "Insert template text here.",
      "available_locations": [
        {
          "id": "123",
          "name": "Capitol Hill"
        },
        {
          "id": "456",
          "name": "Dupont Circle"
        }
      ]
    }
  ],
  "meta": {
    "pagination": {
      "count": 15,
      "pages": 2,
      "page": 1
    }
  }
}

Responses

Status Meaning Description Schema
200 OK Success. PurchaseAgreementList
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Create a purchase agreement

Code samples

# You can also use wget
curl -X POST /api/documents/v1/purchase_agreements \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

POST /api/documents/v1/purchase_agreements HTTP/1.1

Content-Type: application/json
Accept: application/json

const inputBody = '{
  "is_active": true,
  "name": "Monthly Membership Agreements",
  "text": "Your text here.",
  "available_locations": [
    {
      "id": "123",
      "name": "Capitol Hill"
    },
    {
      "id": "456",
      "name": "Dupont Circle"
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/purchase_agreements',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post '/api/documents/v1/purchase_agreements',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/documents/v1/purchase_agreements', headers = headers)

print(r.json())

 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','/api/documents/v1/purchase_agreements', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/purchase_agreements");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/api/documents/v1/purchase_agreements", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /api/documents/v1/purchase_agreements

Add a new purchase agreement.

Body parameter

{
  "is_active": true,
  "name": "Monthly Membership Agreements",
  "text": "Your text here.",
  "available_locations": [
    {
      "id": "123",
      "name": "Capitol Hill"
    },
    {
      "id": "456",
      "name": "Dupont Circle"
    }
  ]
}

Parameters

Name In Type Required Description
body body any false none

Example responses

201 Response

{
  "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "created_by": "123",
  "is_active": true,
  "name": "Monthly Membership Agreement",
  "text": "Insert template text here.",
  "available_locations": [
    {
      "id": "123",
      "name": "Capitol Hill"
    },
    {
      "id": "456",
      "name": "Dupont Circle"
    }
  ]
}

Responses

Status Meaning Description Schema
201 Created Success. PurchaseAgreement
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
422 Unprocessable Entity Request is invalid. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Retrieve a purchase agreement

Code samples

# You can also use wget
curl -X GET /api/documents/v1/purchase_agreements/{agreement_id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

GET /api/documents/v1/purchase_agreements/{agreement_id} HTTP/1.1

Accept: application/json


const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/purchase_agreements/{agreement_id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/api/documents/v1/purchase_agreements/{agreement_id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/documents/v1/purchase_agreements/{agreement_id}', headers = headers)

print(r.json())

 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/api/documents/v1/purchase_agreements/{agreement_id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/purchase_agreements/{agreement_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/documents/v1/purchase_agreements/{agreement_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /api/documents/v1/purchase_agreements/{agreement_id}

View details about a single purchase agreement.

Parameters

Name In Type Required Description
agreement_id path string(UUID) true The UUID of the purchase agreement to retrieve.

Example responses

200 Response

{
  "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "created_by": "123",
  "is_active": true,
  "name": "Monthly Membership Agreement",
  "text": "Insert template text here.",
  "available_locations": [
    {
      "id": "123",
      "name": "Capitol Hill"
    },
    {
      "id": "456",
      "name": "Dupont Circle"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Success. PurchaseAgreement
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
404 Not Found The specified resource cannot be found. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Update a purchase agreement

Code samples

# You can also use wget
curl -X PATCH /api/documents/v1/purchase_agreements/{agreement_id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

PATCH /api/documents/v1/purchase_agreements/{agreement_id} HTTP/1.1

Content-Type: application/json
Accept: application/json

const inputBody = '{
  "text": "Your new text."
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/purchase_agreements/{agreement_id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.patch '/api/documents/v1/purchase_agreements/{agreement_id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.patch('/api/documents/v1/purchase_agreements/{agreement_id}', headers = headers)

print(r.json())

 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','/api/documents/v1/purchase_agreements/{agreement_id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/purchase_agreements/{agreement_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "/api/documents/v1/purchase_agreements/{agreement_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /api/documents/v1/purchase_agreements/{agreement_id}

Update a purchase agreement.

Body parameter

{
  "text": "Your new text."
}

Parameters

Name In Type Required Description
agreement_id path string(UUID) true The UUID of the purchase agreement to update.
body body any false none

Example responses

200 Response

{
  "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "created_by": "123",
  "is_active": true,
  "name": "Monthly Membership Agreement",
  "text": "Insert template text here.",
  "available_locations": [
    {
      "id": "123",
      "name": "Capitol Hill"
    },
    {
      "id": "456",
      "name": "Dupont Circle"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Success. PurchaseAgreement
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
404 Not Found The specified resource cannot be found. None
422 Unprocessable Entity Request is invalid. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Sign a purchase agreement

Code samples

# You can also use wget
curl -X POST /api/documents/v1/purchase_agreements/{agreement_id}/sign \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

POST /api/documents/v1/purchase_agreements/{agreement_id}/sign HTTP/1.1

Content-Type: multipart/form-data
Accept: application/json

const inputBody = '{
  "cart_line_id": "123",
  "purchase_agreement_requirement_id": "2939da5b-357b-4c0f-91b1-95f257d62c7a",
  "signature_image_file": "string",
  "timestamp": "2020-12-09T21:26:34.450482+00:00",
  "user_id": "123"
}';
const headers = {
  'Content-Type':'multipart/form-data',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/purchase_agreements/{agreement_id}/sign',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'multipart/form-data',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post '/api/documents/v1/purchase_agreements/{agreement_id}/sign',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'multipart/form-data',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/documents/v1/purchase_agreements/{agreement_id}/sign', headers = headers)

print(r.json())

 'multipart/form-data',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','/api/documents/v1/purchase_agreements/{agreement_id}/sign', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/purchase_agreements/{agreement_id}/sign");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"multipart/form-data"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/api/documents/v1/purchase_agreements/{agreement_id}/sign", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /api/documents/v1/purchase_agreements/{agreement_id}/sign

Sign a purchase agreement.

Body parameter

cart_line_id: "123"
purchase_agreement_requirement_id: 2939da5b-357b-4c0f-91b1-95f257d62c7a
signature_image_file: string
timestamp: 2020-12-09T21:26:34.450482+00:00
user_id: "123"

Parameters

Name In Type Required Description
agreement_id path string(UUID) true The UUID of the purchase agreement to sign.
body body PurchaseAgreementSignRequest true The request body is sent as multipart/form-data and it contains information needed to sign the Purchase Agreement.

Example responses

200 Response

{
  "purchase_agreement_signatures": [
    {
      "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "broker_id": "123",
      "signed_datetime": "2020-12-09T21:26:34.450482+00:00",
      "user_id": "123",
      "is_signed": true
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Success. PurchaseAgreementSignatureList
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
404 Not Found The specified resource cannot be found. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Legal Documents

A legal document is a legal agreement shown to and agreed to by customers for any of various reasons (e.g. privacy agreement).

Code samples

# You can also use wget
curl -X GET /api/documents/v1/legal_documents \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

GET /api/documents/v1/legal_documents HTTP/1.1

Accept: application/json


const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/legal_documents',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/api/documents/v1/legal_documents',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/documents/v1/legal_documents', headers = headers)

print(r.json())

 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/api/documents/v1/legal_documents', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/legal_documents");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/documents/v1/legal_documents", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /api/documents/v1/legal_documents

View all legal documents. Can be filtered by is_active, is_required_for_users, and is_required_for_employees.

Name In Type Required Description
is_active query boolean false Filter legal documents by whether they are active (is_active=true) or inactive (is_active=false).
is_required_for_users query boolean false Filter legal documents by whether they are required for all users ('is_required_for_users=true') or not required for all users ('is_required_for_users=false')
is_required_for_employees query boolean false Filter legal documents by whether they are required for all users ('is_required_for_employees=true') or not required for all users ('is_required_for_employees=false')

Example responses

200 Response

{
  "results": [
    {
      "document_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "is_active": true,
      "is_signable_by_checkbox": true,
      "name": "Privacy Policy",
      "url": "http://www.google.com/",
      "document_type": "Privacy Agreement",
      "is_required_for_users": true,
      "is_required_for_employees": false
    }
  ],
  "meta": {
    "pagination": {
      "count": 15,
      "pages": 2,
      "page": 1
    }
  }
}
Status Meaning Description Schema
200 OK Success. LegalDocumentList
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Code samples

# You can also use wget
curl -X POST /api/documents/v1/legal_documents \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {access-token}'

POST /api/documents/v1/legal_documents HTTP/1.1

Content-Type: application/json

const inputBody = '{
  "name": "Test Document",
  "document_type": "privacy_agreement",
  "is_active": true,
  "is_signable_by_checkbox": true,
  "url": "https://www.marianatek.com",
  "is_required_for_users": true,
  "is_required_for_employees": false
}';
const headers = {
  'Content-Type':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/legal_documents',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post '/api/documents/v1/legal_documents',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/documents/v1/legal_documents', headers = headers)

print(r.json())

 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','/api/documents/v1/legal_documents', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/legal_documents");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/api/documents/v1/legal_documents", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /api/documents/v1/legal_documents

Add a new legal document.

Body parameter

{
  "name": "Test Document",
  "document_type": "privacy_agreement",
  "is_active": true,
  "is_signable_by_checkbox": true,
  "url": "https://www.marianatek.com",
  "is_required_for_users": true,
  "is_required_for_employees": false
}
Name In Type Required Description
body body any false none
Status Meaning Description Schema
201 Created none None
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
422 Unprocessable Entity Request is invalid. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Code samples

# You can also use wget
curl -X GET /api/documents/v1/legal_documents/{document_id} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

GET /api/documents/v1/legal_documents/{document_id} HTTP/1.1

Accept: application/json


const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/legal_documents/{document_id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/api/documents/v1/legal_documents/{document_id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/documents/v1/legal_documents/{document_id}', headers = headers)

print(r.json())

 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/api/documents/v1/legal_documents/{document_id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/legal_documents/{document_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/documents/v1/legal_documents/{document_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /api/documents/v1/legal_documents/{document_id}

View details about a single legal document.

Name In Type Required Description
document_id path string(UUID) true The UUID of the legal document to retrieve.

Example responses

200 Response

{
  "document_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "is_active": true,
  "is_signable_by_checkbox": true,
  "name": "Privacy Policy",
  "url": "http://www.google.com/",
  "document_type": "Privacy Agreement",
  "is_required_for_users": true,
  "is_required_for_employees": false
}
Status Meaning Description Schema
200 OK Success. LegalDocument
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
404 Not Found The specified resource cannot be found. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Code samples

# You can also use wget
curl -X PATCH /api/documents/v1/legal_documents/{document_id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

PATCH /api/documents/v1/legal_documents/{document_id} HTTP/1.1

Content-Type: application/json
Accept: application/json

const inputBody = '{
  "name": "New Test Document Name"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/legal_documents/{document_id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.patch '/api/documents/v1/legal_documents/{document_id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.patch('/api/documents/v1/legal_documents/{document_id}', headers = headers)

print(r.json())

 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','/api/documents/v1/legal_documents/{document_id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/legal_documents/{document_id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "/api/documents/v1/legal_documents/{document_id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /api/documents/v1/legal_documents/{document_id}

Update a legal document.

Body parameter

{
  "name": "New Test Document Name"
}
Name In Type Required Description
document_id path string(UUID) true The UUID of the legal document to update.
body body any true Legal Document details to update. On legal documents, only the "name", "is_active", "is_required_for_users", and "is_required_for_employees" properties can be modified.

Example responses

200 Response

{
  "document_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "is_active": true,
  "is_signable_by_checkbox": true,
  "name": "New Test Document Name",
  "url": "http://www.google.com/",
  "document_type": "Privacy Agreement",
  "is_required_for_users": true,
  "is_required_for_employees": false
}
Status Meaning Description Schema
200 OK Success. LegalDocument
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
404 Not Found The specified resource cannot be found. None
422 Unprocessable Entity Request is invalid. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Code samples

# You can also use wget
curl -X POST /api/documents/v1/legal_documents/{document_id}/sign \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

POST /api/documents/v1/legal_documents/{document_id}/sign HTTP/1.1

Content-Type: application/json
Accept: application/json

const inputBody = '{
  "user": {
    "id": "123"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/legal_documents/{document_id}/sign',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post '/api/documents/v1/legal_documents/{document_id}/sign',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/documents/v1/legal_documents/{document_id}/sign', headers = headers)

print(r.json())

 'application/json',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','/api/documents/v1/legal_documents/{document_id}/sign', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/legal_documents/{document_id}/sign");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/api/documents/v1/legal_documents/{document_id}/sign", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /api/documents/v1/legal_documents/{document_id}/sign

Sign a legal document.

Body parameter

{
  "user": {
    "id": "123"
  }
}
Name In Type Required Description
user path object true The id of the user signing the agreement.
body body LegalDocumentSignRequest true The request body is sent as application/json and it contains information needed to sign the Legal Document.

Example responses

201 Response

{
  "legal_document": "61a995e3-b484-485a-9799-b873a93e83c6",
  "broker_id": "123",
  "signed_datetime": "2020-12-09T21:26:34.450482+00:00",
  "user_id": "123",
  "source": "Customer Application",
  "is_signed": true
}
Status Meaning Description Schema
201 Created Success. LegalDocumentSignature
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
404 Not Found The specified resource cannot be found. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Purchase Agreement Signatures

A purchase agreement signature represents an instance of a purchase agreement contract that was shown to a user to be signed.

List purchase agreement signatures.

Code samples

# You can also use wget
curl -X GET /api/documents/v1/purchase_agreement_signatures \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

GET /api/documents/v1/purchase_agreement_signatures HTTP/1.1

Accept: application/json


const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/purchase_agreement_signatures',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get '/api/documents/v1/purchase_agreement_signatures',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/api/documents/v1/purchase_agreement_signatures', headers = headers)

print(r.json())

 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','/api/documents/v1/purchase_agreement_signatures', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/purchase_agreement_signatures");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/documents/v1/purchase_agreement_signatures", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /api/documents/v1/purchase_agreement_signatures

View a list of purchase agreement signatures. Each result represents an instance of a purchase agreement text that was generated for a transaction. Available filters are transaction_id, basket_line, user_id, product_id, and is_signed.

Parameters

Name In Type Required Description
transaction_id query string false Filter signatures by the membership or credit transaction ID for the product.
basket_line query string false Filter signatures by the ID of the basket line from the cart.
user_id query string false Filter signatures by the ID of the relevant user.
product_id query string false Filter signatures by the ID of the membership or credit product ID.
is_signed query boolean false Filter signatures by whether or not they have been signed yet.

Example responses

200 Response

{
  "purchase_agreement_signatures": [
    {
      "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "broker_id": "123",
      "signed_datetime": "2020-12-09T21:26:34.450482+00:00",
      "user_id": "123",
      "is_signed": true
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Success. PurchaseAgreementSignatureList
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Sign an unsigned purchase agreement signature.

Code samples

# You can also use wget
curl -X POST /api/documents/v1/purchase_agreement_signatures/{signature_id}/sign \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

POST /api/documents/v1/purchase_agreement_signatures/{signature_id}/sign HTTP/1.1

Content-Type: multipart/form-data
Accept: application/json

const inputBody = '{
  "signature_image_file": "string"
}';
const headers = {
  'Content-Type':'multipart/form-data',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('/api/documents/v1/purchase_agreement_signatures/{signature_id}/sign',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'multipart/form-data',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.post '/api/documents/v1/purchase_agreement_signatures/{signature_id}/sign',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'multipart/form-data',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/api/documents/v1/purchase_agreement_signatures/{signature_id}/sign', headers = headers)

print(r.json())

 'multipart/form-data',
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','/api/documents/v1/purchase_agreement_signatures/{signature_id}/sign', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("/api/documents/v1/purchase_agreement_signatures/{signature_id}/sign");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"multipart/form-data"},
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/api/documents/v1/purchase_agreement_signatures/{signature_id}/sign", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /api/documents/v1/purchase_agreement_signatures/{signature_id}/sign

Sign an unsigned purchase agreement signature.

Body parameter

signature_image_file: string

Parameters

Name In Type Required Description
purchase_agreement_signature_id path string(UUID) true The id of the purchase agreement signature.
body body PurchaseAgreementSignatureSignRequest true The request body is sent as multipart/form-data and it contains the user's signature file.

Example responses

200 Response

{
  "purchase_agreement_signatures": [
    {
      "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "broker_id": "123",
      "signed_datetime": "2020-12-09T21:26:34.450482+00:00",
      "user_id": "123",
      "is_signed": true
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Success. PurchaseAgreementSignatureList
401 Unauthorized Authorization information is missing or invalid. None
403 Forbidden The authenticated user does not have permission to perform this request. None
404 Not Found The specified resource cannot be found. None
503 Service Unavailable The server is temporarily unable to handle this request. None

Schemas

Location

{
  "id": "123",
  "name": "Capitol Hill"
}

Properties

Name Type Required Restrictions Description
id string false read-only The ID of the location.
name string false read-only The name of the location.

Meta

{
  "pagination": {
    "count": 15,
    "pages": 2,
    "page": 1
  }
}

Pagination metadata.

Properties

Name Type Required Restrictions Description
pagination object false none Pagination information.
» count integer false read-only The total number of items.
» pages integer false read-only The total number of pages.
» page integer false none The current page.

PendingPurchaseAgreementSignature

{
  "cart_line_id": "123",
  "location_id": "123",
  "location_name": "Capitol Hill",
  "product_id": "123",
  "product_name": "Premium Monthly Membership",
  "purchase_agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "purchase_agreement_name": "Monthly Membership Agreement",
  "purchase_agreement_requirement_id": "2939da5b-357b-4c0f-91b1-95f257d62c7a",
  "purchase_agreement_url": "https://{BRAND}.marianatek.com/api/documents/v1/pending_purchase_agreement_signatures/9ad4b700-5f8b-4d2c-b2b5-e7b885a90b17/pending_agreement_text?agreement_id=61a995e3-b484-485a-9799-b873a93e83c6"
}

Properties

Name Type Required Restrictions Description
cart_line_id string false read-only The ID of the cart line containing the product for which a signed purchase agreement is required.
location_id string false read-only The ID of the location where the product is being purchased.
location_name string false read-only The name of the location where the product is being purchased.
product_id string false read-only The ID of the product that requires a signed purchase agreement.
product_name string false read-only The name of the product that requires a signed purchase agreement.
purchase_agreement_id string(uuid) false read-only The unique UUID of the purchase agreement that needs to be signed.
purchase_agreement_name string false read-only The name of the purchase agreement that needs to be signed.
purchase_agreement_requirement_id string(uuid) false read-only The unique UUID of the purchase agreement requirement for the product.
purchase_agreement_url string false read-only The link to a web view displaying the purchase agreement text for the customer to review and sign.

PurchaseAgreement

{
  "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "created_by": "123",
  "is_active": true,
  "name": "Monthly Membership Agreement",
  "text": "Insert template text here.",
  "available_locations": [
    {
      "id": "123",
      "name": "Capitol Hill"
    },
    {
      "id": "456",
      "name": "Dupont Circle"
    }
  ]
}

Properties

Name Type Required Restrictions Description
agreement_id string(uuid) false read-only The unique UUID of the purchase agreement.
created_by string false read-only The ID of the user who created the purchase agreement.
is_active boolean false none Whether the purchase agreement is active.
name string false none The name (a.k.a. title) of the purchase agreement.
text string false none The text of the purchase agreement.
available_locations [Location] false none A list of locations where this purchase agreement can be required for products.

PurchaseAgreementList

{
  "results": [
    {
      "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "created_by": "123",
      "is_active": true,
      "name": "Monthly Membership Agreement",
      "text": "Insert template text here.",
      "available_locations": [
        {
          "id": "123",
          "name": "Capitol Hill"
        },
        {
          "id": "456",
          "name": "Dupont Circle"
        }
      ]
    }
  ],
  "meta": {
    "pagination": {
      "count": 15,
      "pages": 2,
      "page": 1
    }
  }
}

Properties

Name Type Required Restrictions Description
results [PurchaseAgreement] false read-only A list of purchase agreements.
meta Meta false none Pagination metadata.

PurchaseAgreementSignature

{
  "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "broker_id": "123",
  "signed_datetime": "2020-12-09T21:26:34.450482+00:00",
  "user_id": "123",
  "is_signed": true
}

Properties

Name Type Required Restrictions Description
agreement_id string(uuid) false read-only The unique UUID of the purchase agreement.
broker_id string false read-only The ID of the user who was authenticated when the purchase agreement was signed.
signed_datetime string(datetime) false read-only When the purchase agreement was signed.
user_id string false read-only The ID of the user who signed the purchase agreement.
is_signed boolean false none True if signed, False if signing was skipped.

PurchaseAgreementSignRequest

{
  "cart_line_id": "123",
  "purchase_agreement_requirement_id": "2939da5b-357b-4c0f-91b1-95f257d62c7a",
  "signature_image_file": "string",
  "timestamp": "2020-12-09T21:26:34.450482+00:00",
  "user_id": "123"
}

Properties

Name Type Required Restrictions Description
cart_line_id string false none The ID of the cart line for which the purchase agreement is being signed.
purchase_agreement_requirement_id string(uuid) false none The unique UUID of the purchase agreement requirement for the product.
signature_image_file string(binary) false none A image of the user's signature.
timestamp string(datetime) false none The time at which the request is being made.
user_id string false none The ID of the user who is signing the purchase agreement.

PurchaseAgreementSignatureSignRequest

{
  "signature_image_file": "string"
}

Properties

Name Type Required Restrictions Description
signature_image_file string(binary) false none A image of the user's signature.

PurchaseAgreementSignatureList

{
  "purchase_agreement_signatures": [
    {
      "agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "broker_id": "123",
      "signed_datetime": "2020-12-09T21:26:34.450482+00:00",
      "user_id": "123",
      "is_signed": true
    }
  ]
}

Properties

Name Type Required Restrictions Description
purchase_agreement_signatures [PurchaseAgreementSignature] false none none

UsersWithPendingSignaturesList

{
  "results": [
    {
      "customer_id": "123",
      "customer_email": "wednesday@marianatek.com",
      "customer_name": "Wednesday Addams",
      "pending_signatures": [
        {
          "cart_line_id": "123",
          "location_id": "123",
          "location_name": "Capitol Hill",
          "product_id": "123",
          "product_name": "Premium Monthly Membership",
          "purchase_agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
          "purchase_agreement_name": "Monthly Membership Agreement",
          "purchase_agreement_requirement_id": "2939da5b-357b-4c0f-91b1-95f257d62c7a",
          "purchase_agreement_url": "https://{BRAND}.marianatek.com/api/documents/v1/pending_purchase_agreement_signatures/9ad4b700-5f8b-4d2c-b2b5-e7b885a90b17/pending_agreement_text?agreement_id=61a995e3-b484-485a-9799-b873a93e83c6"
        }
      ]
    }
  ],
  "meta": {
    "pagination": {
      "count": 15,
      "pages": 2,
      "page": 1
    }
  }
}

Properties

Name Type Required Restrictions Description
results [UserWithPendingSignatures] false read-only A list of users who have purchase agreements awaiting signature.
meta Meta false none Pagination metadata.

UserWithPendingSignatures

{
  "customer_id": "123",
  "customer_email": "wednesday@marianatek.com",
  "customer_name": "Wednesday Addams",
  "pending_signatures": [
    {
      "cart_line_id": "123",
      "location_id": "123",
      "location_name": "Capitol Hill",
      "product_id": "123",
      "product_name": "Premium Monthly Membership",
      "purchase_agreement_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "purchase_agreement_name": "Monthly Membership Agreement",
      "purchase_agreement_requirement_id": "2939da5b-357b-4c0f-91b1-95f257d62c7a",
      "purchase_agreement_url": "https://{BRAND}.marianatek.com/api/documents/v1/pending_purchase_agreement_signatures/9ad4b700-5f8b-4d2c-b2b5-e7b885a90b17/pending_agreement_text?agreement_id=61a995e3-b484-485a-9799-b873a93e83c6"
    }
  ]
}

Properties

Name Type Required Restrictions Description
customer_id string false read-only The ID of the user who has purchase agreements awaiting signature.
customer_email string false read-only The email of the user who has purchase agreements awaiting signature.
customer_name string false read-only The name of the user who has purchase agreements awaiting signature.
pending_signatures [PendingPurchaseAgreementSignature] false none none

LegalDocument

{
  "document_id": "61a995e3-b484-485a-9799-b873a93e83c6",
  "is_active": true,
  "is_signable_by_checkbox": true,
  "name": "Privacy Policy",
  "url": "http://www.google.com/",
  "document_type": "Privacy Agreement",
  "is_required_for_users": true,
  "is_required_for_employees": false
}

Properties

Name Type Required Restrictions Description
document_id string(uuid) false read-only The unique UUID of the legal document.
is_active boolean false none Whether the legal document is active.
is_signable_by_checkbox boolean false none Whether the legal document is able to me signed and agreed to by the user selecting a checkbox.
name string false none The name (a.k.a. title) of the legal document.
url string false none The url pointing to the legal document
document_type string false none Category of the legal document.
is_required_for_users boolean false none Boolean indicating of Legal Document is required to be signed by all users, including employees.
is_required_for_employees boolean false none Boolean indicating if Legal Document is required to be signed by all employees, but not all users.

LegalDocumentList

{
  "results": [
    {
      "document_id": "61a995e3-b484-485a-9799-b873a93e83c6",
      "is_active": true,
      "is_signable_by_checkbox": true,
      "name": "Privacy Policy",
      "url": "http://www.google.com/",
      "document_type": "Privacy Agreement",
      "is_required_for_users": true,
      "is_required_for_employees": false
    }
  ],
  "meta": {
    "pagination": {
      "count": 15,
      "pages": 2,
      "page": 1
    }
  }
}

Properties

Name Type Required Restrictions Description
results [LegalDocument] false read-only A list of legal documents.
meta Meta false none Pagination metadata.

LegalDocumentSignRequest

{
  "user": {
    "id": "123"
  }
}

Properties

Name Type Required Restrictions Description
user object false none none
» id string false none ID of user that is signing the legal document.

LegalDocumentSignature

{
  "legal_document": "61a995e3-b484-485a-9799-b873a93e83c6",
  "broker_id": "123",
  "signed_datetime": "2020-12-09T21:26:34.450482+00:00",
  "user_id": "123",
  "source": "Customer Application",
  "is_signed": true
}

Properties

Name Type Required Restrictions Description
legal_document string(uuid) false read-only The unique UUID of the legal_document.
broker_id string false read-only The ID of the user who was authenticated when the legal document was signed.
signed_datetime string(datetime) false read-only When the legal document was signed.
user_id string false read-only The ID of the user who signed the legal document.
source string false none The name of the application from which the sign request was made.
is_signed boolean false none Boolean indicating if the LegalDocumentSignature object has been signed by the user.