

Last date modified: June 17 2025
The Relativity Contracts application uses offset data to link field values to text in a contract document. Offsets can be created through the Contracts Viewer using the Send to Field feature, but they can also be created and managed through the Contracts Offsets Service REST API.
The Contracts Offsets Service exposes CRUD endpoints that you can use to programmatically manipulate offsets in your Relativity environment.
Some use cases for the Contracts Offsets Service include:
The following general guidelines apply for working with this service.
The URLs for the Contracts Offsets Service's REST endpoints contain path parameters that you need to set before making a call:
For example, you can use the following URL to retrieve the offsets associated with a contract document:
<host>/Relativity.Rest/API/contracts/{versionNumber}/offsets/{workspaceId}/document/{documentId}
You'd set the path parameters as follows:
To use the Contracts Offsets Service, send requests by making calls with the required HTTP methods.
You can download a .NET example project here.
To create one or more offsets, send a POST request with a URL in this format:
<host>/Relativity.Rest/API/contracts/{versionNumber}/offsets/{workspaceId}/document/{documentId}
<host>/Relativity.Rest/API/contracts/{versionNumber}/offsets/{workspaceId}/document/{documentId}
To create an offset on a document, the user making the request must have Object and Item Level permissions to Edit the document.
The body of the request must contain an Offsets field, which is an array of objects defining the offsets you want to create.
An offset contains the following fields:
0
or null
.
0
or null
. Creating new offsets with specific IDs is not supported, and attempting to do so will result in either an existing offset being updated (if one with the Id already exists) or a new offset being created with an Id equal to the largest existing offset Id+1, NOT the Id specified.null
or a positive decimal number.null
or a positive decimal number.null
or a a non-negative decimal number.null
or a non-negative decimal number.null
or a positive integer greater than or equal to 1.{
"Offsets": [
{
"Id": 0,
"DocumentId": 1041445,
"FieldId": 1042006,
"AssociatedArtifactId": 1041445,
"ChoiceId": null,
"Offset": 489,
"Length": 211,
"Height": null,
"Width": null,
"Left": null,
"Top": null,
"PageNumber": null
},
{
"DocumentId": 1041445,
"FieldId": 1042012,
"AssociatedArtifactId": 1041445,
"Offset": 14,
"Length": 104,
}
]
}
The body of the response contains an array of objects defining the offsets that were successfully created or updated (see Upsert Offsets for more info on why the create endpoint works this way).
Each offset object in the response contains the following fields (fields marked with * will be omitted from an offset object if their value is null
):
null
.
[
{
"Id": 9,
"DocumentId": 1041445,
"FieldId": 1042006,
"AssociatedArtifactId": 1041445,
"Offset": 489,
"Length": 211
},
{
"Id": 10,
"DocumentId": 1041445,
"FieldId": 1042006,
"AssociatedArtifactId": 1041445,
"Offset": 14,
"Length": 104
}
]
To get the offsets associated with a particular document, send a GET request with a URL in the following format:
<host>/Relativity.Rest/API/contracts/{versionNumber}/offsets/{workspaceId}/document/{documentId}
The offset objects in the response for a read operation contain the same fields as those for a create response. See the field descriptions for the response in Create Offsets.
To update one or more offsets, send a POST request with a URL in this format:
<host>/Relativity.Rest/API/contracts/{versionNumber}/offsets/{workspaceId}/document/{documentId}
To update an offset on a document, the user making the request must have Object and Item Level permissions to Edit the document.
The body of the request must contain an Offsets field, which is an array of objects defining the offsets you want to update and the state you want them to be in after the update.
An offset contains the following fields:
null
or a positive decimal number.null
or a positive decimal number.null
or a a non-negative decimal number.null
or a non-negative decimal number.null
or a positive integer greater than or equal to 1.{
"Offsets": [
{
"Id": 12,
"DocumentId": 1041445,
"FieldId": 1042006,
"AssociatedArtifactId": 1041445,
"ChoiceId": null,
"Offset": 489,
"Length": 211,
"Height": null,
"Width": null,
"Left": null,
"Top": null,
"PageNumber": null
},
{
"Id": 3,
"DocumentId": 1041445,
"FieldId": 1042012,
"AssociatedArtifactId": 1041445,
"ChoiceId": 1042316,
"Offset": 14,
"Length": 104,
}
]
}
The body of the response contains an array of objects defining the offsets that were successfully created or updated (see Upsert Offsets for more info on why the update endpoint works this way).
Each offset object in the response contains the following fields (fields marked with * will be omitted from an offset object if their value is null
):
null
.
[
{
"Id": 9,
"DocumentId": 1041445,
"FieldId": 1042006,
"AssociatedArtifactId": 1041445,
"Offset": 489,
"Length": 211
},
{
"Id": 10,
"DocumentId": 1041445,
"FieldId": 1042006,
"AssociatedArtifactId": 1041445,
"Offset": 14,
"Length": 104
}
]
To remove an offset from a document, send a DELETE request with a URL in the following format:
<host>/Relativity.Rest/API/contracts/{versionNumber}/offsets/{workspaceId}/document/{documentId}/{offsetId}
The offsetId parameter is the ID of the offset to be deleted. It can be found in the Id field of an offset in a read response. See Read Offsets.
Both the request and response bodies are empty. When an offset was successfully deleted, the response returns a status code of 200.
To delete an offset from a document, the user making the request must have Object and Item Level permissions to Edit the document.
The Contracts Offsets Service's create and update operations use the same endpoint, and that endpoint upserts the requested offsets. This allows multiple offsets to upserted in the same request.
If a requested offset has an Id of 0
or null
, or if the Id field is not included, a new offset will be created.
If the offset has an Id > 0
, and the offset with that Id exists, the existing offset is updated to match what was requested.
The request and response structure are the same as those for the Create and Update APIs.
To upsert an offset on a document, the user making the request must have Object and Item Level permissions to Edit the document.
Why was this not helpful?
Check one that applies.
Thank you for your feedback.
Want to tell us more?
Great!
Additional Resources |
|||
DevHelp Community | GitHub | Release Notes | NuGet |