Skip to content

Batches (lower level)

V1_BatchAPI26 actions

The lower-level work item API. Each change needs an explicit lock, commit and unlock. Prefer V1_KWorkItemAPI.

Every call in this group

  • Method POST to https://{tenant}/api/{Group}/{Action}, also for reads.
  • Header TempIdentityToken: <token>. Create tokens in Configuration > Services > API Access.
  • Success HTTP 200 with { "Success": true, "MessageKey": ..., "Data": ... }. Always check Success.
  • Failure HTTP 412 with { "Success": false, "Messages": [ { "MessageKey": ... } ] }. The spec lists failures as 400; the server sends 412. HTTP 401 means the token or its features; HTTP 422 means the body does not match the model.
  • C# samples Use the generated client KL.APIClient. Generate the client from your tenant's spec (how). A non-200 status throws KL.APIClient.Client.ApiException.
  • Guides API introduction, Authentication

Actions

Action Summary
AddBatchDocumentPages Adds page files to the specified batch that were previously made available to the batch through a call to AddBatchFile
AddBatchDocuments Adds document files to the specified batch that were previously made available to the batch through a call to AddBatchFile
AddBatchFile Uploads a file (in parallel) to be added to the batch as either a document or page file
AddDocument Creates a new document object in the context of the specified batch.
AddDocumentFile Uploads a file to be added to the specified document as an input or output file.
AddPage Creates a new page object in the context of the specified batch and document.
CommitBatch Saves the current state of the batch in the batch system to the batch authority.
GetBatch Retrieves a projection of the structure of the specified batch, including documents, pages, and various metadata.
GetDocumentFile Downloads the specified document file.
LockBatch Locks an existing batch to the user associated with the API token used to invoke this endpoint.
MovePages Moves Pages from Document to Target Document
NewBatch Creates a new batch object in the context of the batch system.
ReadBatch Retrieves a batch token for the specified batch id.
RemoveBatch Removes the specified batch from the batch system.
RemoveBatchMetadata Removes metadata values from the specified batch's metadata collection.
RemoveDocument Removes and discards the specified document from its batch.
RemoveDocumentFile Removes and discards the specified document file from its document.
RemoveDocumentMetadata Removes metadata values from the specified document's metadata collection.
RemovePage Removes and discards the specified page from its document.
RemovePageMetadata Removes metadata values from the specified page's metadata collection.
ReorderDocument Reorders a document in a batch by assigning it to the specified index and shifting the order of other documents in the batch.
ReorderPage Reorders a page in a document by assigning it to the specified index and shifting the order of other pages in the document.
UnlockBatch Unlocks an existing batch.
UpsertBatchMetadata Adds or updates metadata values in the specified batch's metadata collection.
UpsertDocumentMetadata Adds or updates metadata values in the specified document's metadata collection.
UpsertPageMetadata Adds or updates metadata values in the specified page's metadata collection.

AddBatchDocumentPages

POST/api/V1_BatchAPI/AddBatchDocumentPages

Adds page files to the specified batch that were previously made available to the batch through a call to AddBatchFile

  • Content type: application/json

Request

Input.

Schema: AddDocumentPagesParameter. Parameter allowing for adding multiple pages to a document at once

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) The Id of the document to insert pages into
Pages array of PageFileInputParameter A collection of pages to be added after they have been uploaded

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerAddBatchDocumentPagesAsync(new AddDocumentPagesParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    Pages = new List<PageFileInputParameter> { new PageFileInputParameter
        {
            PageId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
            MetadataToSet = new List<MetadataValueDTO>(),
            Info = new BatchFileIdentifierDTO(),
            FileNameHint = "string",
            LengthHint = 0,
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocumentPages" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "Pages": [{}]}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "Pages": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocumentPages" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocumentPages",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "Pages": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocumentPages", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "Pages": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

AddBatchDocuments

POST/api/V1_BatchAPI/AddBatchDocuments

Adds document files to the specified batch that were previously made available to the batch through a call to AddBatchFile

  • Content type: application/json

Request

Input.

Schema: AddDocumentsParameter. Parameter allowing for adding multiple documents at once

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
Documents array of DocumentFileInputParameter A collection of documents to be added after they have been uploaded

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908918",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerAddBatchDocumentsAsync(new AddDocumentsParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    Documents = new List<DocumentFileInputParameter> { new DocumentFileInputParameter
        {
            DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
            MetadataToSet = new List<MetadataValueDTO>(),
            Info = new BatchFileIdentifierDTO(),
            FileNameHint = "string",
            LengthHint = 0,
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocuments" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "Documents": [{}]}'
$body = @'
{
  "BatchToken": null,
  "Documents": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocuments" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocuments",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "Documents": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchDocuments", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "Documents": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

AddBatchFile

POST/api/V1_BatchAPI/AddBatchFile

Uploads a file (in parallel) to be added to the batch as either a document or page file

  • Content type: multipart/form-data

Request

Form fields (multipart/form-data):

Field Type Required Description
File file No The contents of the file to be uploaded as a new document file
Payload string No An JSON-stringified object used to transport values used during document file addition. EXAMPLE: {"BatchToken":{"BatchId":"3b82f062-eec3-4b0b-8e7c-c06ef17e2db8","LockId":"48082aec-55e6-4c93-9cf9-824218ccf7e8","LocationId":"c756c773-b406-40c0-97fe-7b0a67f70591"},"Identifier":"422810ce-7894-4841-987f-b72df24ce28d","DocumentFileName":"Example.png","DocumentFileMIMEType":"image/png"}

Response

Returns a reference to the uploaded file.

Envelope: DataResponseBatchFileDTO. Data is BatchFileIdentifierDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Hash": "abcdefabcdef",
    "Identifier": "1e5081f9-819b-4607-abde-25a12ed57165"
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerAddBatchFileAsync(File.OpenRead("document.pdf"), "string");
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddBatchFile" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -F "file=@./document.pdf" -F "...other form fields..."

AddDocument

POST/api/V1_BatchAPI/AddDocument

Creates a new document object in the context of the specified batch.

  • Content type: application/json

Request

Identifying information about the batch and its lock status and an identifier to assign to the new document.

Schema: DocumentIdentifierParameter. Identifying information about the batch and its lock status and an identifier to assign to the new document

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908918",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerAddDocumentAsync(new DocumentIdentifierParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddDocument" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddDocument" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddDocument",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddDocument", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

AddDocumentFile

POST/api/V1_BatchAPI/AddDocumentFile

Uploads a file to be added to the specified document as an input or output file.

  • Content type: multipart/form-data

Request

Form fields (multipart/form-data):

Field Type Required Description
File file No The contents of the file to be uploaded as a new document file
Payload string No An JSON-stringified object used to transport values used during document file addition. EXAMPLE: {"BatchToken":{"BatchId":"3b82f062-eec3-4b0b-8e7c-c06ef17e2db8","LockId":"48082aec-55e6-4c93-9cf9-824218ccf7e8","LocationId":"c756c773-b406-40c0-97fe-7b0a67f70591"},"DocumentId":"422810ce-7894-4841-987f-b72df24ce28d","DocumentFileId":"00f3a2f6-6873-4c49-a062-20fdf4c18f8b","DocumentFileType":0,"DocumentFileName":"Example.png","DocumentFileMIMEType":"image/png"}

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908918",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerAddDocumentFileAsync(File.OpenRead("document.pdf"), "string");
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddDocumentFile" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -F "file=@./document.pdf" -F "...other form fields..."

AddPage

POST/api/V1_BatchAPI/AddPage

Creates a new page object in the context of the specified batch and document.

  • Content type: application/json

Request

Identifying information about the batch and document and an identifier to assign to the new page.

Schema: PageIdentifierParameter. Identifying information about the batch and document and an identifier to assign to the new page

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
PageId string (uuid) ID of the page

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerAddPageAsync(new PageIdentifierParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    PageId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddPage" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "PageId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "PageId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddPage" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddPage",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "PageId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/AddPage", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "PageId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

CommitBatch

POST/api/V1_BatchAPI/CommitBatch

Saves the current state of the batch in the batch system to the batch authority.

  • Content type: application/json

Request

An object containing identifying information about the batch and its lock status.

Schema: BatchTokenDTO. An object containing identifying information about the batch and its lock status

Field Type Description
BatchId string (uuid) ID of the batch
LockId string (uuid) ID representing the instance of the lock that exists on the batch; if null, then the batch is not locked
LocationId string (uuid) ID of the location that the batch resides in

Response

Returns a batch token containing identifying information about the batch and its lock status.

Envelope: DataResponseBatchToken. Data is BatchTokenDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": null,
    "LocationId": "00000000-0000-0000-0000-000000000000"
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerCommitBatchAsync(new BatchTokenDTO
{
    BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/CommitBatch" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchId": "00000000-0000-0000-0000-000000000000", "LockId": "00000000-0000-0000-0000-000000000000", "LocationId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchId": "00000000-0000-0000-0000-000000000000",
  "LockId": "00000000-0000-0000-0000-000000000000",
  "LocationId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/CommitBatch" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/CommitBatch",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchId": "00000000-0000-0000-0000-000000000000",
                    "LockId": "00000000-0000-0000-0000-000000000000",
                    "LocationId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/CommitBatch", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": "00000000-0000-0000-0000-000000000000",
    "LocationId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

GetBatch

POST/api/V1_BatchAPI/GetBatch

Retrieves a projection of the structure of the specified batch, including documents, pages, and various metadata.

  • Content type: application/json

Request

An object containing identifying information about the batch and its lock status.

Schema: BatchTokenDTO. An object containing identifying information about the batch and its lock status

Field Type Description
BatchId string (uuid) ID of the batch
LockId string (uuid) ID representing the instance of the lock that exists on the batch; if null, then the batch is not locked
LocationId string (uuid) ID of the location that the batch resides in

Response

Returns a projection of the structure of the specified batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908918",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerGetBatchAsync(new BatchTokenDTO
{
    BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetBatch" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchId": "00000000-0000-0000-0000-000000000000", "LockId": "00000000-0000-0000-0000-000000000000", "LocationId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchId": "00000000-0000-0000-0000-000000000000",
  "LockId": "00000000-0000-0000-0000-000000000000",
  "LocationId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetBatch" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetBatch",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchId": "00000000-0000-0000-0000-000000000000",
                    "LockId": "00000000-0000-0000-0000-000000000000",
                    "LocationId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetBatch", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": "00000000-0000-0000-0000-000000000000",
    "LocationId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

GetDocumentFile

POST/api/V1_BatchAPI/GetDocumentFile

Downloads the specified document file.

  • Content type: application/json

Request

Identifying information about the batch, document, and document file.

Schema: DocumentFileIdentifierParameter. Identifying information about the batch, document, and document file

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
DocumentFileId string (uuid) ID of the document file

Response

Returns the requested document file as content.

Returns file.

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

using var stream = await api.V1BatchAPIControllerGetDocumentFileAsync(new DocumentFileIdentifierParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    DocumentFileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
using var output = File.Create("download.bin");
await stream.CopyToAsync(output);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetDocumentFile" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "DocumentFileId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "DocumentFileId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetDocumentFile" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetDocumentFile",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "DocumentFileId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/GetDocumentFile", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "DocumentFileId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

LockBatch

POST/api/V1_BatchAPI/LockBatch

Locks an existing batch to the user associated with the API token used to invoke this endpoint.

  • Content type: application/json

Request

An object containing identifying information about the batch.

Schema: BatchIdentifierParameter. Identifying information about the batch

Field Type Description
BatchId string (uuid) ID of the batch

Response

Returns a batch token containing identifying information about the batch and its lock status.

Envelope: DataResponseBatchToken. Data is BatchTokenDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": null,
    "LocationId": "00000000-0000-0000-0000-000000000000"
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerLockBatchAsync(new BatchIdentifierParameter
{
    BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/LockBatch" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/LockBatch" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/LockBatch",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/LockBatch", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

MovePages

POST/api/V1_BatchAPI/MovePages

Moves Pages from Document to Target Document

  • Content type: application/json

Request

Input.

Schema: MovePagesParameter. Parameter allowing for moving pages from one batch to another

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) The Id of the document to move pages from
TargetDocumentId string (uuid) The Id of the document to insert pages into
PageIds array of string (uuid) A collection of page ids to be added to the target document

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerMovePagesAsync(new MovePagesParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    TargetDocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    PageIds = new List<Guid> { Guid.Parse("00000000-0000-0000-0000-000000000000") },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/MovePages" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "TargetDocumentId": "00000000-0000-0000-0000-000000000000", "PageIds": ["00000000-0000-0000-0000-000000000000"]}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "TargetDocumentId": "00000000-0000-0000-0000-000000000000",
  "PageIds": [
    "00000000-0000-0000-0000-000000000000"
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/MovePages" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/MovePages",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "TargetDocumentId": "00000000-0000-0000-0000-000000000000",
                    "PageIds": [
                      "00000000-0000-0000-0000-000000000000"
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/MovePages", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "TargetDocumentId": "00000000-0000-0000-0000-000000000000",
    "PageIds": [
      "00000000-0000-0000-0000-000000000000"
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

NewBatch

POST/api/V1_BatchAPI/NewBatch

Creates a new batch object in the context of the batch system.

  • Content type: application/json

Request

An object containing identifying information about the batch.

Schema: BatchIdentifierParameter. Identifying information about the batch

Field Type Description
BatchId string (uuid) ID of the batch

Response

Returns a batch token containing identifying information about the batch and its lock status.

Envelope: DataResponseBatchToken. Data is BatchTokenDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": null,
    "LocationId": "00000000-0000-0000-0000-000000000000"
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerNewBatchAsync(new BatchIdentifierParameter
{
    BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/NewBatch" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/NewBatch" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/NewBatch",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/NewBatch", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

ReadBatch

POST/api/V1_BatchAPI/ReadBatch

Retrieves a batch token for the specified batch id.

  • Content type: application/json

Request

An object containing identifying information about the batch.

Schema: BatchIdentifierParameter. Identifying information about the batch

Field Type Description
BatchId string (uuid) ID of the batch

Response

Returns a batch token containing identifying information about the batch and its lock status.

Envelope: DataResponseBatchToken. Data is BatchTokenDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": null,
    "LocationId": "00000000-0000-0000-0000-000000000000"
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerReadBatchAsync(new BatchIdentifierParameter
{
    BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReadBatch" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReadBatch" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReadBatch",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReadBatch", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

RemoveBatch

POST/api/V1_BatchAPI/RemoveBatch

Removes the specified batch from the batch system.

  • Content type: application/json

Request

An object containing identifying information about the batch and its lock status.

Schema: BatchTokenDTO. An object containing identifying information about the batch and its lock status

Field Type Description
BatchId string (uuid) ID of the batch
LockId string (uuid) ID representing the instance of the lock that exists on the batch; if null, then the batch is not locked
LocationId string (uuid) ID of the location that the batch resides in

Response

The specified batch was successfully removed from the batch system.

Envelope: KLApiResponse.

Example response
{
  "Success": true,
  "MessageKey": null
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerRemoveBatchAsync(new BatchTokenDTO
{
    BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatch" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchId": "00000000-0000-0000-0000-000000000000", "LockId": "00000000-0000-0000-0000-000000000000", "LocationId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchId": "00000000-0000-0000-0000-000000000000",
  "LockId": "00000000-0000-0000-0000-000000000000",
  "LocationId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatch" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatch",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchId": "00000000-0000-0000-0000-000000000000",
                    "LockId": "00000000-0000-0000-0000-000000000000",
                    "LocationId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatch", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": "00000000-0000-0000-0000-000000000000",
    "LocationId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

RemoveBatchMetadata

POST/api/V1_BatchAPI/RemoveBatchMetadata

Removes metadata values from the specified batch's metadata collection.

  • Content type: application/json

Request

Identifying information about the batch and the metadata to remove from the batch.

Schema: BatchMetadataAPIParameter. Identifying information about the batch and the metadata to add to or update on the batch

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
Metadata array of MetadataValueDTO A collection of objects describing metadata in triplets of bucket, key, and value

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerRemoveBatchMetadataAsync(new BatchMetadataAPIParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    Metadata = new List<MetadataValueDTO> { new MetadataValueDTO
        {
            Bucket = "string",
            Key = "string",
            Value = "string",
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatchMetadata" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "Metadata": [{}]}'
$body = @'
{
  "BatchToken": null,
  "Metadata": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatchMetadata" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatchMetadata",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "Metadata": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveBatchMetadata", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "Metadata": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

RemoveDocument

POST/api/V1_BatchAPI/RemoveDocument

Removes and discards the specified document from its batch.

  • Content type: application/json

Request

Identifying information about the batch and document.

Schema: DocumentIdentifierParameter. Identifying information about the batch and its lock status and an identifier to assign to the new document

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerRemoveDocumentAsync(new DocumentIdentifierParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocument" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocument" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocument",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocument", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

RemoveDocumentFile

POST/api/V1_BatchAPI/RemoveDocumentFile

Removes and discards the specified document file from its document.

  • Content type: application/json

Request

Identifying information about the batch, document, and document file.

Schema: DocumentFileIdentifierParameter. Identifying information about the batch, document, and document file

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
DocumentFileId string (uuid) ID of the document file

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerRemoveDocumentFileAsync(new DocumentFileIdentifierParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    DocumentFileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentFile" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "DocumentFileId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "DocumentFileId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentFile" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentFile",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "DocumentFileId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentFile", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "DocumentFileId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

RemoveDocumentMetadata

POST/api/V1_BatchAPI/RemoveDocumentMetadata

Removes metadata values from the specified document's metadata collection.

  • Content type: application/json

Request

Identifying information about the batch and document and the metadata to remove from the document.

Schema: DocumentMetadataAPIParameter. Identifying information about the batch and document and the metadata to add to or update on the document

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
Metadata array of MetadataValueDTO A collection of objects describing metadata in triplets of bucket, key, and value

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerRemoveDocumentMetadataAsync(new DocumentMetadataAPIParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    Metadata = new List<MetadataValueDTO> { new MetadataValueDTO
        {
            Bucket = "string",
            Key = "string",
            Value = "string",
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentMetadata" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "Metadata": [{}]}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "Metadata": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentMetadata" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentMetadata",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "Metadata": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemoveDocumentMetadata", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "Metadata": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

RemovePage

POST/api/V1_BatchAPI/RemovePage

Removes and discards the specified page from its document.

  • Content type: application/json

Request

Identifying information about the batch, document, and page.

Schema: PageIdentifierParameter. Identifying information about the batch and document and an identifier to assign to the new page

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
PageId string (uuid) ID of the page

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerRemovePageAsync(new PageIdentifierParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    PageId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePage" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "PageId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "PageId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePage" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePage",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "PageId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePage", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "PageId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

RemovePageMetadata

POST/api/V1_BatchAPI/RemovePageMetadata

Removes metadata values from the specified page's metadata collection.

  • Content type: application/json

Request

Identifying information about the batch, document, and page and the metadata to remove from the page.

Schema: PageMetadataAPIParameter. Identifying information about the batch, document, and page and the metadata to add to or update on the page

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
PageId string (uuid) ID of the page
Metadata array of MetadataValueDTO A collection of objects describing metadata in triplets of bucket, key, and value

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerRemovePageMetadataAsync(new PageMetadataAPIParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    PageId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    Metadata = new List<MetadataValueDTO> { new MetadataValueDTO
        {
            Bucket = "string",
            Key = "string",
            Value = "string",
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePageMetadata" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "PageId": "00000000-0000-0000-0000-000000000000", "Metadata": [{}]}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "PageId": "00000000-0000-0000-0000-000000000000",
  "Metadata": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePageMetadata" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePageMetadata",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "PageId": "00000000-0000-0000-0000-000000000000",
                    "Metadata": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/RemovePageMetadata", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "PageId": "00000000-0000-0000-0000-000000000000",
    "Metadata": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

ReorderDocument

POST/api/V1_BatchAPI/ReorderDocument

Reorders a document in a batch by assigning it to the specified index and shifting the order of other documents in the batch.

  • Content type: application/json

Request

Identifying information about the batch and document and the new index of the document in the batch's document collection.

Schema: ReorderDocumentParameter. Identifying information about the batch and document and the new index of the document in the batch's document collection

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
NewIndex integer Index to assign to the document to be reordered

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerReorderDocumentAsync(new ReorderDocumentParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    NewIndex = 0,
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderDocument" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "NewIndex": 0}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "NewIndex": 0
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderDocument" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderDocument",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "NewIndex": 0
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderDocument", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "NewIndex": 0
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

ReorderPage

POST/api/V1_BatchAPI/ReorderPage

Reorders a page in a document by assigning it to the specified index and shifting the order of other pages in the document.

  • Content type: application/json

Request

Identifying information about the batch, document, and page and the new index of the page in the document's page collection.

Schema: ReorderPageParameter. Identifying information about the batch, document, and page and the new index of the page in the document's page collection

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
PageId string (uuid) ID of the page
NewIndex integer Index to assign to the page to be reordered

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerReorderPageAsync(new ReorderPageParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    PageId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    NewIndex = 0,
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderPage" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "PageId": "00000000-0000-0000-0000-000000000000", "NewIndex": 0}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "PageId": "00000000-0000-0000-0000-000000000000",
  "NewIndex": 0
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderPage" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderPage",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "PageId": "00000000-0000-0000-0000-000000000000",
                    "NewIndex": 0
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/ReorderPage", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "PageId": "00000000-0000-0000-0000-000000000000",
    "NewIndex": 0
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

UnlockBatch

POST/api/V1_BatchAPI/UnlockBatch

Unlocks an existing batch.

  • Content type: application/json

Request

An object containing identifying information about the batch and its lock status.

Schema: BatchTokenDTO. An object containing identifying information about the batch and its lock status

Field Type Description
BatchId string (uuid) ID of the batch
LockId string (uuid) ID representing the instance of the lock that exists on the batch; if null, then the batch is not locked
LocationId string (uuid) ID of the location that the batch resides in

Response

Returns a batch token containing identifying information about the batch and its lock status.

Envelope: DataResponseBatchToken. Data is BatchTokenDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": null,
    "LocationId": "00000000-0000-0000-0000-000000000000"
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerUnlockBatchAsync(new BatchTokenDTO
{
    BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UnlockBatch" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchId": "00000000-0000-0000-0000-000000000000", "LockId": "00000000-0000-0000-0000-000000000000", "LocationId": "00000000-0000-0000-0000-000000000000"}'
$body = @'
{
  "BatchId": "00000000-0000-0000-0000-000000000000",
  "LockId": "00000000-0000-0000-0000-000000000000",
  "LocationId": "00000000-0000-0000-0000-000000000000"
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UnlockBatch" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UnlockBatch",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchId": "00000000-0000-0000-0000-000000000000",
                    "LockId": "00000000-0000-0000-0000-000000000000",
                    "LocationId": "00000000-0000-0000-0000-000000000000"
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UnlockBatch", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchId": "00000000-0000-0000-0000-000000000000",
    "LockId": "00000000-0000-0000-0000-000000000000",
    "LocationId": "00000000-0000-0000-0000-000000000000"
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

UpsertBatchMetadata

POST/api/V1_BatchAPI/UpsertBatchMetadata

Adds or updates metadata values in the specified batch's metadata collection.

  • Content type: application/json

Request

Identifying information about the batch and the metadata to add to or update on the batch.

Schema: BatchMetadataAPIParameter. Identifying information about the batch and the metadata to add to or update on the batch

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
Metadata array of MetadataValueDTO A collection of objects describing metadata in triplets of bucket, key, and value

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerUpsertBatchMetadataAsync(new BatchMetadataAPIParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    Metadata = new List<MetadataValueDTO> { new MetadataValueDTO
        {
            Bucket = "string",
            Key = "string",
            Value = "string",
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertBatchMetadata" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "Metadata": [{}]}'
$body = @'
{
  "BatchToken": null,
  "Metadata": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertBatchMetadata" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertBatchMetadata",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "Metadata": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertBatchMetadata", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "Metadata": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

UpsertDocumentMetadata

POST/api/V1_BatchAPI/UpsertDocumentMetadata

Adds or updates metadata values in the specified document's metadata collection.

  • Content type: application/json

Request

Identifying information about the batch and document and the metadata to add to or update on the document.

Schema: DocumentMetadataAPIParameter. Identifying information about the batch and document and the metadata to add to or update on the document

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
Metadata array of MetadataValueDTO A collection of objects describing metadata in triplets of bucket, key, and value

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerUpsertDocumentMetadataAsync(new DocumentMetadataAPIParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    Metadata = new List<MetadataValueDTO> { new MetadataValueDTO
        {
            Bucket = "string",
            Key = "string",
            Value = "string",
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertDocumentMetadata" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "Metadata": [{}]}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "Metadata": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertDocumentMetadata" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertDocumentMetadata",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "Metadata": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertDocumentMetadata", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "Metadata": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);

UpsertPageMetadata

POST/api/V1_BatchAPI/UpsertPageMetadata

Adds or updates metadata values in the specified page's metadata collection.

  • Content type: application/json

Request

Identifying information about the batch, document, and page and the metadata to add to or update on the page.

Schema: PageMetadataAPIParameter. Identifying information about the batch, document, and page and the metadata to add to or update on the page

Field Type Description
BatchToken object An object containing identifying information about the batch and its lock status
DocumentId string (uuid) ID of the document
PageId string (uuid) ID of the page
Metadata array of MetadataValueDTO A collection of objects describing metadata in triplets of bucket, key, and value

Response

Returns a projection of the structure of the affected batch, including documents, pages, and various metadata.

Envelope: DataResponseBatchProjection. Data is BatchProjectionDTO.

Example response
{
  "Success": true,
  "MessageKey": null,
  "Data": {
    "Id": "00000000-0000-0000-0000-000000000000",
    "Name": "20261007-201908919",
    "Documents": [
      {
        "Id": "00000000-0000-0000-0000-000000000000",
        "Index": "0",
        "Pages": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Index": "0",
            "OriginalFileName": "Example original page name",
            "PageFiles": [
              {
                "Id": "00000000-0000-0000-0000-000000000000",
                "FileName": "Example page file name",
                "Extension": ".tif",
                "FileSize": 102456,
                "LocationHash": "Do not alter this value!",
                "Type": "Raw",
                "Metadata": {
                  "Example Bucket": {
                    "Example Key": "Example Value"
                  }
                }
              }
            ],
            "Metadata": {
              "Example Bucket": {
                "Example Key": "Example Value"
              }
            }
          }
        ],
        "Files": [
          {
            "Id": "00000000-0000-0000-0000-000000000000",
            "FileName": "Example FileName",
            "Extension": ".pdf",
            "LocationHash": "Do not alter this value!",
            "Type": "Input"
          }
        ],
        "Metadata": {
          "Example Bucket": {
            "Example Key": "Example Value"
          }
        }
      }
    ],
    "Metadata": {
      "Example Bucket": {
        "Example Key": "Example Value"
      }
    }
  }
}

Example

using KL.APIClient.Api;
using KL.APIClient.Client;
using KL.APIClient.Model;

var config = new Configuration { BasePath = "https://yourcompany.knowledgelake.io/api" };
config.AddApiKey("TempIdentityToken", Environment.GetEnvironmentVariable("KL_TOKEN"));
var api = new V1BatchAPIApi(config);

var response = await api.V1BatchAPIControllerUpsertPageMetadataAsync(new PageMetadataAPIParameter
{
    BatchToken = new BatchTokenDTO
    {
        BatchId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LockId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
        LocationId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    },
    DocumentId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    PageId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
    Metadata = new List<MetadataValueDTO> { new MetadataValueDTO
        {
            Bucket = "string",
            Key = "string",
            Value = "string",
        } },
});
if (response.Success != true) throw new Exception(response.MessageKey);
Console.WriteLine(response.Data);
curl -sS -X POST "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertPageMetadata" \
  -H "TempIdentityToken: $KL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"BatchToken": null, "DocumentId": "00000000-0000-0000-0000-000000000000", "PageId": "00000000-0000-0000-0000-000000000000", "Metadata": [{}]}'
$body = @'
{
  "BatchToken": null,
  "DocumentId": "00000000-0000-0000-0000-000000000000",
  "PageId": "00000000-0000-0000-0000-000000000000",
  "Metadata": [
    {}
  ]
}
'@
$r = Invoke-RestMethod -Method Post -Uri "https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertPageMetadata" `
  -Headers @{ TempIdentityToken = $env:KL_TOKEN } `
  -ContentType "application/json" -Body $body
if (-not $r.Success) { throw $r.MessageKey }
$r.Data
import os, requests

r = requests.post("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertPageMetadata",
                  headers={"TempIdentityToken": os.environ["KL_TOKEN"]},
                  json={
                    "BatchToken": null,
                    "DocumentId": "00000000-0000-0000-0000-000000000000",
                    "PageId": "00000000-0000-0000-0000-000000000000",
                    "Metadata": [
                      {}
                    ]
                  })
data = r.json()
if not data.get("Success"):
    raise RuntimeError(data.get("MessageKey") or data.get("Messages"))
print(data["Data"])
const r = await fetch("https://yourcompany.knowledgelake.io/api/V1_BatchAPI/UpsertPageMetadata", {
  method: "POST",
  headers: { "TempIdentityToken": process.env.KL_TOKEN, "Content-Type": "application/json" },
  body: JSON.stringify({
    "BatchToken": null,
    "DocumentId": "00000000-0000-0000-0000-000000000000",
    "PageId": "00000000-0000-0000-0000-000000000000",
    "Metadata": [
      {}
    ]
  })
});
const data = await r.json();
if (!data.Success) throw new Error(data.MessageKey ?? JSON.stringify(data.Messages));
console.log(data.Data);