idevops | Posts: 1

unauthorized trying to create a document package with python.

0 votes
Hello, I'm using python and trying to create a document package from the example I downloaded from the forums. I used the api key in my admin panel and replaced the api key but I'm still getting an unauthorized. Also, is there a way to just send a template I have setup with Owner, and Signer1 with the rest api. I have the fields setup on a template and I would like to just set the signer1 data and send it to both parties? also tried https://sandbox.esignlive.com/api/packages https://sandbox.e-signlive.com/api/packages
import requests
import json
import os
#create and send package in one call

url = "https://sandbox.e-signlive.com/api/packages"
payload = json.dumps({"documents":[{"id":"_8nAQ9iRWqZ-C95ouB8aauVUMC0=","name":"NDA"}],"status":"DRAFT","type":"PACKAGE","roles":[{"type":"SIGNER","id":"Signer1","signers":[{"email":"[email protected]","firstName":"Grant","lastName":"Zukel","id":"Signer1"}],"name":"Signer1"}],"name":"NDA"})
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path = dir_path + '\\idevops\\static\\contracts\\nda.pdf'
file = open(dir_path, 'rb')
files = {'payload': payload,'file': file}
headers = {
    'Authorization': "myapikey",
    'accept': "application/json"
    }
response = requests.post(url, files=files, headers=headers, verify=False)
print(response.text)

Duo_Liang | Posts: 3776

Reply to: unauthorized trying to create a document package with python.

0 votes
Hi there, First, about the "unauthorized " error, did you use'authorization': "Basic api_key",instead of directly put your api key? As you noticed, it's using the HTTP Basic authentication as a credential to validate your api call. And about your scenario, do you want your owner to be a reviewer of the package(created by template)? Can you tell me more about your requirement so that we can find out some solutions. Hope this could help! Duo

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off