API Guide

 

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/contractTypes> \\
  -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.

Response


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


Contracts

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, se

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/>](<https://api.docjuris.com/v1/contracts/:id/turns>)43e36b4d-5711-49ff-a6d1-c252452fcf0f[/turns](<https://api.docjuris.com/v1/contracts/:id/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/>](<https://api.docjuris.com/v1/contracts/:id/turns>)43e36b4d-5711-49ff-a6d1-c252452fcf0f[/turns](<https://api.docjuris.com/v1/contracts/:id/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.

contractScreeningReport: An excel file summarizing which playbook issues were found in the turn.

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"
			},
			...
		]
  }
}

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.

Create an Import

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>"
		}
  }
}

Subscriptions

API consumers can create a subscription, supplying a callback URL to which various notifications will be delivered.

Manage Subscription

Create Subscription

curl <https://api.docjuris.com/v1/subscriptions> \\
  -u <account_id>:<api_key> \\
  -d '{"webhookUrl": "<my url>", "type": "<type>"}'

Arguments


webhookUrl

Url that will be called by DocJuris when the desired event occurs. Must be publicly accessible, and contain any key string or identifier needed by the recipient.

type

Type of events that will be sent via this subscription. Options are:

  • turnCompleted
  • turnTagged
  • turnCreated
  • turnMention

Response


{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": {    
		"id": "C5672EE4-2FC3-49A3-9D07-08F8E27B7696",
		"type": "turnTagged",
    "created": "2020-02-05T19:28:14.9835627Z"
  }
}

The returned ID can be used to proactively query for recent messages or delete the subscription.

List Subscriptions

curl <https://api.docjuris.com/v1/subscriptions> \\
  -u <account_id>:<api_key>

Response


{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": [
		{    
			"id": "C5672EE4-2FC3-49A3-9D07-08F8E27B7696",
			"type": "turnTagged",
	    "created": "2020-02-05T19:28:14.9835627Z"
	  },
		{    
			"id": "DDC61EEF-4F76-405E-B305-3BEF21B55FFA",
			"type": "turnMention",
	    "created": "2020-02-06T13:48:13.2835239Z"
	  }
	]
}

Delete Subscription

curl -X DELETE <https://api.docjuris.com/v1/subscriptions/{id}> \\
  -u <account_id>:<api_key> 

Arguments


id

Subscription id returned from create call.

Response


Returns Http 200 on success.

Messages

Get sent messages

curl <https://api.docjuris.com/v1/subscriptions/{id}/messages?skip=30&take=100> \\
  -u <account_id>:<api_key>

Arguments


id

Subscription id

Response


{
  "meta": {
    "code": 200,
    "errorType": null,
    "errorDetail": null
  },
  "response": [
		{    
			"messageId": "C5672EE4-2FC3-49A3-9D07-08F8E27B7696",
			"type": "turnTagged",
	    "url": "<https://app.docjuris.com/contracts/1/turns/AC2EFD0E-4B3B-4880-BA2B-90A617FA2938>",
			"contractId": "1C5147D6-318E-4BC2-B088-D2D6E08E03DA",
			"turnId": "AC2EFD0E-4B3B-4880-BA2B-90A617FA2938",
			"sentOn": "2020-02-05T19:28:14.9835627Z"
	  },
		{    
			"messageId": "C5672EE4-2FC3-49A3-9D07-08F8E27B7696",
			"type": "turnCompleted",
	    "url": "<https://app.docjuris.com/contracts/1/turns/AC2EFD0E-4B3B-4880-BA2B-90A617FA2938>",
			"contractId": "1C5147D6-318E-4BC2-B088-D2D6E08E03DA",
			"turnId": "AC2EFD0E-4B3B-4880-BA2B-90A617FA2938",
			"sentOn": "2020-02-05T19:28:14.9835627Z"
	  },
		{    
			"messageId": "C5672EE4-2FC3-49A3-9D07-08F8E27B7696",
			"type": "turnMention",
	    "url": "<https://app.docjuris.com/contracts/1/turns/AC2EFD0E-4B3B-4880-BA2B-90A617FA2938>",
			"contractId": "1C5147D6-318E-4BC2-B088-D2D6E08E03DA",
			"turnId": "AC2EFD0E-4B3B-4880-BA2B-90A617FA2938",
			"sentOn": "2020-02-05T19:28:14.9835627Z",
			"mention": {
				"text": "@joe take a look at this",
				"mentioningUser": {
					"firstName": "Paul",
					"lastName": "Bunyan",
					"userName": "paul@lumberjacks.ok"
				},
				"mentionedUser": {
					"firstName": "Joe",
					"lastName": "Flenderson",
					"userName": "joe@joesdiner.com"
				},
				"commentId": "1768727E-B3CD-4DA0-B029-AA3876BD35AB",
				"url": "<https://app.docjuris.com/contracts/1/turns/AC2EFD0E-4B3B-4880-BA2B-90A617FA2938?commentId=1768727E-B3CD-4DA0-B029-AA3876BD35AB>"
			}
	  }
	]
}

The returned ID can be used to proactively query for recent messages or delete the subscription.

Event Notifications

These are the body of messages posted to the url supplied during subscription creation.

Turn Complete / Turn Tagged / Turn Created Notifications

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

{
  "messageId": "C5672EE4-2FC3-49A3-9D07-08F8E27B7696",
	"type": "TurnCompleted",
  "contractId": "1C5147D6-318E-4BC2-B088-D2D6E08E03DA",
	"turnId" : "43e36b4d-5711-49ff-a6d1-c252452fcf0f",
  "sentOn": "2020-02-05T19:28:14.9835627Z",
	"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


messageId

Unique identifier for the message.

type

One of: turnTagged turnCompleted turnCreated

contractId

DocJuris contract ID.

turnId

DocJuris turn ID.

sentOn

Message timestamp

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 Mention Notification

Send when

{    
	"messageId": "C5672EE4-2FC3-49A3-9D07-08F8E27B7696",
	"type": "turnMention",
  "url": "<https://app.docjuris.com/contracts/1/turns/AC2EFD0E-4B3B-4880-BA2B-90A617FA2938>",
	"contractId": "1C5147D6-318E-4BC2-B088-D2D6E08E03DA",
	"turnId": "AC2EFD0E-4B3B-4880-BA2B-90A617FA2938",
	"sentOn": "2020-02-05T19:28:14.9835627Z",
	"mention": {
		"text": "@joe take a look at this",
		"mentioningUser": {
			"firstName": "Paul",
			"lastName": "Bunyan",
			"userName": "paul@lumberjacks.ok"
		},
		"mentionedUser": {
			"firstName": "Joe",
			"lastName": "Flenderson",
			"userName": "joe@joesdiner.com"
		},
		"commentId": "1768727E-B3CD-4DA0-B029-AA3876BD35AB",
		"url": "<https://app.docjuris.com/contracts/1/turns/AC2EFD0E-4B3B-4880-BA2B-90A617FA2938?commentId=1768727E-B3CD-4DA0-B029-AA3876BD35AB>"
	}
}

Values


messageId

Unique identifier for the message.

type

Always "turnMention" for this event type.

contractId

DocJuris contract ID.

turnId

DocJuris turn ID.

sentOn

Message timestamp

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.

mention

Detail about the mention (see example above)