Skip to content
On this page

Managing Documents

When you create a new Transaction, you are required to include at least one Document, one Participant, and one Task per Document/Participant. However, after the Transaction is created, you can add new Documents or update existing Documents via the API at any point as long as the transaction is still in the Pending status.

Insert a Document

In order to insert a new Document into an existing Transaction, you'll need provide Transaction ID along with the new Document's details. At least one Task is required in the newly inserted Document, as well.

csharp
var req = new DocumentInsertRequestModel() {
    Documents = new List<object> {
        new DocumentInsertModel() {
            TransactionID = 1234567890,
                Title = "Web Services Insert Test Document",
                Source = new SourceModel() {
                    FilePath = @ "c:\myDocument.pdf"
                },
                Tasks = new List<object> {
                    new TaskInsertModel() {
                        ParticipantID = 1987654320
                    }
                }
        }
    }
};

var api = new DocumentsApi(myRestEndpointUrl);
var results = api.InsertDocuments(req, apiKey, apiSecret, apiUsername, apiPassword);;
if (results.IsSuccessful.Value) {
    //do work...
} else {
    //handle error
}

Update a Document

In order to update an existing Document, you'll need to retrieve an existing "Updateable" Document first. Once you have the DocumentUpdateModel you can add/update/delete any properties you wish from that object and then all the UpdateDocuments() method to commit the update.

csharp
var req = new DocumentUpdateableRequestModel() {
    IDs = new List<object> {
        1234567890
    }
};

var api = new DocumentsUpdateableApi(myRestEndpointUrl);
var results = api.GetDocumentsUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value) {
    results.UpdateableDocuments[0].Title = "UPDATED!";
    var updateModel = new DocumentUpdateRequestModel() {
        Documents = results.UpdateableDocuments
    };
    
    var api = new DocumentsApi(myRestEndpointUrl);
	var updateResults = api.UpdateDocuments(req, apiKey, apiSecret, apiUsername, apiPassword);
    if (updateResults.IsSuccessful) {
        //do work...
    } else {
        //handle error
    }
} else {
    //handle error
}

Update a Completed Document

csharp
var req = new DocumentCompletedUpdateableRequestModel()
            {
                IDs = new List<object> { 1234567890 }
            };

var api = new DocumentsUpdateableApi(myRestEndpointUrl);
var results = api.GetDocumentsCompletedUpdateable(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
	results.UpdateableDocuments[0].Title = "UPDATED!";
    var updateModel = new DocumentCompletedUpdateRequestModel()
                      {
                          Documents = results.UpdateableDocuments
                      };
    
    var api = new DocumentsUpdateableApi(myRestEndpointUrl);
	var updateResults = api.UpdateDocumentsCompleted(req, apiKey, apiSecret, apiUsername, apiPassword);
	if (updateResults.IsSuccessful)
	{
		//do work...
	}
	else
	{
	    //handle error
	}
}
else
{
    //handle error
}

Update Form Fields

csharp
var req = new DocumentUpdateFormFieldsRequestModel() {
    DocumentFormFields = new List<object> {
        new DocumentFormFieldsModel() {
            DocumentID = 1000435535,
                FormFields = new FList<object> {
                    new FormFieldModel() {
                            Name = "City",
                                Value = "Dallas"
                        },
                        new FormFieldModel() {
                            Name = "State",
                                Value = "TX"
                        }
                }
        }
    }
};

var api = new DocumentsApi(myRestEndpointUrl);
var results = api.UpdateDocumentFormFields(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value) {
    //do work...
} else {
    //handle error
}

Stamp Text in a Document

csharp
var req = new DocumentUpdateTextStampsRequestModel() {
    DocumentTextStamps = new List<object> {
        new DocumentTextStampsModel() {
            DocumentID = 1234567890,
                TextStamps = new List<object> {
                    new TextStampModel() {
                            TextToStamp = "THIS IS A TEST",
                                FontColor = TextStampModel.FontColorEnum.Black,
                                FontSize = 10,
                                PageCoordinatesPageNumber = 1,
                                XOffset = 50,
                                YOffset = 50
                        },
                        new TextStampModel() {
                            TextToStamp = "Another test!",
                                FontColor = TextStampModel.FontColorEnum.Blue,
                                FontSize = 8,
                                SearchTextText = "{{MyPlaceHolderText}}",
                                SearchTextStartPosition = TextStampModel.SearchTextStartPositionEnum.Bottom
                        },
                        new TextStampModel() {
                            TextToStamp = "Yes Another test!",
                                FontColor = TextStampModel.FontColorEnum.Red,
                                FontSize = 8,
                                SearchTextText = "{{MyPlaceHolderText}}",
                                SearchTextStartPosition = TextStampModel.SearchTextStartPositionEnum.Top,
                                SearchTextInstance = 2
                        },
                        new TextStampModel() {
                            TextToStamp = "FORM FIELD PLACEMENT",
                                FontColor = TextStampModel.FontColorEnum.Red,
                                FontSize = 8,
                                FormFieldFieldName = "Date",
                                XOffset = 20,
                                YOffset = 20
                        }
                }
        }
    }
};
var result = serviceClient.UpdateDocumentTextStamps(req, apiKey, apiSecret, apiUsername, apiPassword);
if (result.IsSuccessful) {
    // do work
} else {
    // handle error
}