Executing a Document

Use the POST /documents/{id}/executions endpoint to run a document with input and receive the output.
Want to customize document executions? You can add optional parameters like:

Authorization

To access the Logic API, you will need to provide an authorization token. This token is used to authenticate your requests and ensure that only authorized users can access your documents.
Learn more about authorization and how to set up your API token in the Authorization section.

Generic Request Example

To evaluate the document, make a POST request to the endpoint with your input as the body. Calling a document will differ depending on the input schema of your document. The following example shows how to make a request to a document of your choosing. You can see a more specific example below.
curl -X POST 'https://api.logic.inc/2024-03-01/documents/{document_id}/executions' 
    -H "Authorization: Bearer $LOGIC_API_TOKEN" 
    -H "Content-Type: application/json" -d '{
      {YOUR INPUT JSON HERE}
    }'
Replace any {id} in the example code, such as {document_id} with the ID you need for your specific API call.
Replace {YOUR INPUT JSON HERE} with the correct input for your document. You can find the required fields in your document’s Input Schema.

Specific Example Request

Making a request to a document will differ depending on the input schema of your document. For this example, the input schema requires a content field. This document is used as a Redact PII API. You pass in a string, and it will return the string with PII redacted, as well as an array of the redacted entities. The following example shows how to make a request to this document.
curl -X POST 'https://api.staging.logic.inc/2024-03-01/documents/d0844039-9f16-40ba-b93e-405f043ef88a/executions' 
    -H "Authorization: Bearer $LOGIC_API_TOKEN" 
    -H "Content-Type: application/json" -d '{
      "content": "Steve emailed me at my personal address: mary@yahoo.com."
    }'
This document redacts PII from a block of text. Your document may expect different input—refer to its input schema for details.

Example Response

{
  "redactedText": "{{ name }} emailed me at my personal address: {{ email }}.",
  "redactedEntities": [
    "Steve",
    "mary@yahoo.com"
  ]
}