API Guide

Article author
Gaby Estrada
  • Updated

General

Authentication

Authentication to the API is performed via HTTP Basic Auth. Your username is your account ID and the password is your API key. You can view both and manage your API key in the Settings area inside the DocJuris application.

All API requests must be made over HTTPS. Call made over plain HTTP will fail. Calls made without or with an invalid/expired key will also fail.

Example via cURL:

curl https://api.docjuris.com/v1/contracts \
  -u <username>:<password>

Uploading Documents

When uploading password protected documents, you can pass it to us as a base64 encoded value via the documentPassword header.

For example, to upload a document protected with the password "hello":

curl https://api.docjuris.com/v1/contracts \
  -u <account_id>:<api_key> \
  -H "documentPassword: aGVsbG8="

Response

Calls to the API will return with a HTTP response code that help indicate success or failure of the request.

Every response will have a standard shape:

{
  "meta": {...},
  "response": {...},
}

Meta

code

This will match the HTTP response code.

errors

An array of Error objects

Error

type

Short string indicating the error type.

message

A more lengthly explanation of the error.

data

Extra data describing the error.

Example Responses

Most responses will have a section with urls to retrieve the record in the api, or to redirect to the relevant page in DocJuris.

"urls": {
	"app": "https://app.docjuris.com/contracts/12/turns/DED5A313-CC4D-4218-8B0B-2F175C8539D4",
	"api": "https://api.docjuris.com/v1/contracts/B41A4A25-E692-4B4C-9002-6560DE291315/turns/DED5A313-CC4D-4218-8B0B-2F175C8539D4",
  "document": "https://api.docjuris.com/v1/contracts/B41A4A25-E692-4B4C-9002-6560DE291315/turns/DED5A313-CC4D-4218-8B0B-2F175C8539D4/document" 
} 

Common Data

extendedData

Contracts and turns can be created with extendedData. This data will be attached to the contract record, and can be retrieved with later queries. It can be used to store reference data relevant to the caller, or to pass reference urls to DocJuris.

The data is structured as name value pairs:

"extendedData": {
	"namedValues": [
    {
			"name": "v1",
			"value": "data1",
	    "type": "text"
    },
		{
			"name": "Contract link",
			"value": "https://my.app.com?someId=abc",
			"type": "url"
		}
	]
}

Values with type "url" will be displayed in the DocJuris UI under a list of links for the contract. This can be used to link back to the calling application.

Values with type "text" are not displayed in the DocJuris UI. If no type is given, the default value is "text".

All values will be returned with the contract or turn details.

Resources

Create a Contract

This is a multipart/form-data request.

curl https://api.docjuris.com/v1/contracts \
  -u <account_id>:<api_key> \
  -F contractType=nda
  -F counterPartyName=company_a
  -F extendedData='{"namedValues": [{"name": "v1", "value": "data1"}]}'
  -F file="@/path/to/your/contract.docx"

Arguments (besides file) can be supplied as form name/value pairs, or they can be combined into a single json string named input.

curl https://api.docjuris.com/v1/contracts \
  -u <account_id>:<api_key> \
  -F input='{"contractType":"nda", "counterParty":"company_a", "extendedData": {"namedValues": [{"name": "v1", "value": "data1"}]}}'
  -F file="@/path/to/your/contract.docx"

Arguments

contractType

A string representing the type of contract. Must match a contract type in the DocJuris app.

An alternate option is to supply contractTypeId, which is the DocJuris contract Id.

counterParty

A string representing the counter party for this contract.

An alternate option is to supply counterPartyId, which is the DocJuris contract Id.

description optional

An arbitrary string that provides a short summary of the transaction within the contract.

file

DOCX files are preferred as PDF and DOC will be run through our convertor, and may lead to unexpected results.

extendedData optional

This data will be attached to the contract record, and can be retrieved with later queries. For details, see Common Data

Response

{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": {
    "counterParty": {
      "id": 1,
      "name": "Company A"
    },
    "description": "",
    "id": "4fd24682-dba7-4b8b-84de-6c0d47fde78c",
    "lastModified": "2020-01-31T15:13:56.361811Z",
    "name": "my contract",
    "turns": [
      {
        "changeCount": 0,
        "id": "c4d2d8fc-23b6-4df7-94a7-26f95c41f256",
        "isComplete": true,
        "lastModified": "2020-01-31T15:14:01.2517127Z",
        "source": "Company A"
			}
    ],
    "type": {
      "description": "",
      "id": 1,
      "name": "NDA"
    },
		"extendedData": {
			"namedValues": [
        {
					"name": "v1",
					"value": "data1"
				}
			]
		},
    "urls": {
			"app": "https://app.docjuris.com/contracts/12",
			"api": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c",
			"document": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/document"
		}
  }
}

Get Contract Details

curl https://api.docjuris.com/v1/contracts/FC42F186-3F64-42F4-B03C-F6DCC8EC17DD \
  -u <account_id>:<api_key>

Response

{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": {
    "counterParty": {
      "id": 1,
      "name": "Company A"
    },
    "description": "",
    "id": "4fd24682-dba7-4b8b-84de-6c0d47fde78c",
    "lastModified": "2020-01-31T15:13:56.361811Z",
    "name": "my contract",
    "turns": [
      {
        "changeCount": 0,
        "id": "c4d2d8fc-23b6-4df7-94a7-26f95c41f256",
        "isComplete": true,
        "lastModified": "2020-01-31T15:14:01.2517127Z",
        "source": "Company A",
			}
    ],
    "type": {
      "description": "",
      "id": 1,
      "name": "NDA"
    },
		"extendedData": {
			"namedValues": [
		    {
					"name": "v1",
					"value": "data1"
				}
			]
		},
    "urls": {
			"app": "https://app.docjuris.com/contracts/12",
			"api": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c",
			"document": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/document",
		}
  }
}

Add Turn to a Contract

This is a multipart/form-data request.

curl https://api.docjuris.com/v1/contracts/:id/turns \
  -u <account_id>:<api_key> \
  -F currentTurnId="FC42F186-3F64-42F4-B03C-F6DCC8EC17DD"
  -F source=companyA
  -F description="some description"
  -F extendedData='{"namedValues": [{"name": "v1", "value": "data1"}]}'
  -F file="@/path/to/your/contract.docx"

Arguments (besides file) can be supplied as form name/value pairs, or they can be combined into a single json string named input.

curl https://api.docjuris.com/v1/contracts \
  -u <account_id>:<api_key> \
  -F input='{"currentTurnId":"FC42F186-3F64-42F4-B03C-F6DCC8EC17DD", "source":"company_a", "description: "some description", "extendedData": {"namedValues": [{"name": "v1", "value": "data1"}]}}'
  -F file="@/path/to/your/contract.docx"

Arguments

currentTurnId

A string ID of the latest known turn. The API will return an error if this does not match that latest turn's ID (i.e. if another turn was uploaded by another user).

description optional

An arbitrary string that provides a short summary of the turn.

file

DOCX files are preferred as PDF and DOC will be run through our convertor, and may lead to unexpected results.

source optional

A string that describes who this turn is from (i.e. internal dept., outside counsel, etc.).

If this turn is from the counter party, leave this blank.

extendedData optional

This data will be attached to the turn record, and can be retrieved with later queries. If no value is supplied, the extended data from the contract will be copied to the turn.

For details, see Common Data.

tags optional

Within DocJuris, the user can add tags to a turn. These tags provide additional client-specific information about the turn.

  • ImportedIsExecutionCopy (1ccc94a7-e71b-4e03-9bb9-995a6a63f568)
  • ExportedIsExecutionCopy (56651238-5584-40e6-8957-d8ddcb3ea689)

Response

{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": {
    "id": "43e36b4d-5711-49ff-a6d1-c252452fcf0f",
    "lastModified": "2020-02-05T19:28:14.9835627Z",
    "source": "Company A",
    "urls": {
			"app": "https://app.docjuris.com/contracts/12/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0",
			"api": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0",
			"document": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0/document"
		},
		"extendedData": {
			"namedValues": [
				{
					"name": "v1",
					"value": "data1"
				}
			]
		},
		"tags": [
			{
				"id": "1ccc94a7-e71b-4e03-9bb9-995a6a63f568",
				"name": "Execution Copy",
				"description": "Execution Copy"
			}
		]
  }
}

Get Turn Details

curl https://api.docjuris.com/v1/contracts/43e36b4d-5711-49ff-a6d1-c252452fcf0f/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0 \
-u <account_id>:<api_key>

Response

{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": {
    "id": "43e36b4d-5711-49ff-a6d1-c252452fcf0f",
    "lastModified": "2020-02-05T19:28:14.9835627Z",
    "source": "Company A",
		"importedFileName": "document.pdf",
    "urls": {
			"app": "https://app.docjuris.com/contracts/12/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0",
			"api": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0",
			"document": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0/document"
		},
		"extendedData": {
			"namedValues": [
				{
					"name": "v1",
					"value": "data1",
					"type": "text"
				}
			]
		},
		"tags": [
			{
				"id": "1ccc94a7-e71b-4e03-9bb9-995a6a63f568",
				"name": "Execution Copy",
				"description": "Execution Copy"
			}
		]
  }
}

Get Turn Document

Retrieve the documents for a turn.

curl https://api.docjuris.com/v1/contracts/43e36b4d-5711-49ff-a6d1-c252452fcf0f/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0/document \
-u <account_id>:<api_key>

Query string parameters

docState - optional

values:

completedWithMarkup : Document with changes applied via DocJuris as redlines. Turn must be completed.

completedClean : Document with changes applied via DocJuris. Turn must be completed.

original (default) : Original document, converted to .docx if necessary.

imported : Original document, not converted or edited.

Get Contract Types

Fetches contract types.

curl https://api.docjuris.com/v1/contractTypes?skip=100&take=200&sortBy=id \
  -u <account_id>:<api_key>

Arguments

skip optional

Number of contract types to skip, ordered by sortBy. Defaults to 0.

take optional

Number of contract types to return. Defaults to 200.

sortBy optional

One of "name", "id", "description". Defaults to "name".

filter optional

Filters the resulting list by partial case insensitive match. Will match .*filter.*

Response

{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": {
    "skip": 0,
		"take": 200,
		"sortBy": "name",
		"totalCount": 8,
		"contractTypes": [
			{
				"id": 1,
				"name": "ContractTypeA",
				"description": "Some Description"
			},
			{
				"id": 8,
				"name": "ContractTypeH",
				"description": "Some Other Description"
			},
			...
		]
  }
}

Create an Import

An import is a raw document that DocJuris users can select as a new contract or contract turn within the DocJuris app. This allows users to enter DocJuris specific details within the DocJuris application.

This is a multipart/form-data request.

curl https://api.docjuris.com/v1/imports \
  -u <account_id>:<api_key> \
  -F extendedData='{"namedValues": [{"name": "v1", "value": "data1"}]}' \
  -F file="@/path/to/your/import.docx"

Arguments (besides file) can be supplied as form name/value pairs, or they can be combined into a single json string named input.

curl https://api.docjuris.com/v1/imports \
  -u <account_id>:<api_key> \
  -F input='{"extendedData": {"namedValues": [{"name": "v1", "value": "data1"}]}}' \
  -F file="@/path/to/your/contract.docx"

Arguments

extendedData optional

This data will be attached to the contract record, and can be retrieved with later queries. For details, see Common Data.

Response

{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": {    
		"extendedData": {
			"namedValues": [
				{
					"name": "v1",
					"value": "data1",
					"type": "text"
				}
			]
		},
    "urls": {
			"app": "https://app.docjuris.com/importd/4fd24682-dba7-4b8b-84de-6c0d47fde78c"
		}
  }
}

Callback Notifications

Each DocJuris tenant can be configured with a callback URL. DocJuris will call this url when certain events occur, as a notification. Each notification is a simple POST to the configured url with a JSON body.

Turn Complete Notification

This notification will be sent when the DocJuris user completes a turn.

{
	"type": "TurnCompleted",
	"id" : "43e36b4d-5711-49ff-a6d1-c252452fcf0f",
	"extendedData": {
		"namedValues": [
			{
				"name": "v1",
				"value": "data1",
				"type": "text"
			}
		]
	},
  "tags": [
		{
			"id": "1ccc94a7-e71b-4e03-9bb9-995a6a63f568",
			"name": "Execution Copy",
			"description": "Execution Copy"
		}
	],
	"url": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0"
}

Values

type

Always "TurnCompleted" for this event type.

id

DocJuris turn ID.

extendedData

Contains the extended data attached to this turn. This extended data could have originated in an API call to create a turn, or in an API call to create an import, if that import was used to create a turn in DocJuris.

url

URL for API call to retrieve detailed data about the completed turn.

Turn Tagged Notification

This notification will be sent if the user adds a tag in DocJuris to a completed turn.

{
	"type": "TurnTagged",
	"id" : "43e36b4d-5711-49ff-a6d1-c252452fcf0f",
	"extendedData": {
		"namedValues": [
			{
				"name": "v1",
				"value": "data1",
				"type": "text"
			}
		]
	},
  "tags": [
		{
			"id": "1ccc94a7-e71b-4e03-9bb9-995a6a63f568",
			"name": "Execution Copy",
			"description": "Execution Copy"
		}
	],
	"url": "https://api.docjuris.com/v1/contracts/4fd24682-dba7-4b8b-84de-6c0d47fde78c/turns/43e36b4d-5711-49ff-a6d1-c252452fcf0"
}

Values

type

Always "TurnTagged" for this event type.

id

DocJuris turn ID.

extendedData

Contains the extended data attached to this turn. This extended data could have originated in an API call to create a turn, or in an API call to create an import, if that import was used to create a turn in DocJuris.

url

 

URL for API call to retrieve detailed data about the completed turn. 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.