Skip to main content
POST
/
{workspaceId}
/
files
/
extract
/
structuredData
fileExtractStructuredDataSync
import { IntunedClient } from "@intuned/client";

const intunedClient = new IntunedClient({
  apiKey: "<YOUR_API_KEY_HERE>",
  workspaceId: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
});

async function run() {
  const result = await intunedClient.files.extractStructuredData.sync({
    file: {
      type: "pdf",
      source: {
        type: "url",
        data: "https://intuned.io/example.pdf",
      },
    },
    dataSchema: {
      "type": "object",
      "description": "Employee Information",
      "properties": {
        "name": {
          "type": "string",
        },
        "age": {
          "type": "number",
        },
        "jobTitle": {
          "type": "string",
        },
      },
    },
  });

  // Handle the result
  console.log(result);
}

run();
{
"operationId": "aaaabbbCCCCdddd",
"status": "completed",
"result": {
"firstName": "John",
"lastName": "Doe",
"jobTitle": "Manager"
}
}

Authorizations

x-api-key
string
header
required

API Key used to authenticate your requests. How to create one.

Path Parameters

workspaceId
string<uuid>
required

Your workspace ID. How to find it?

Body

application/json

The request to extract structured data from file

file
object
required

Image file data to extract from

  • Image
  • PDF
  • Spreadsheet
dataSchema
object
required

The schema (in JSONSchema) to which the extracted data should conform to. More about JSONSchema

strategy
object

The strategy to extract structured data from a file. Includes the model and type of extraction.

  • Option 1
  • Option 2
prompt
string

Prompt given to the AI model to help with extraction.

Response

The extracted data

  • Successful
  • Failed

Structured data extraction result Successful file extraction result

result
any
required

The extracted data formatted according to the input dataSchema

operationId
string
required

Operation ID.

status
enum<string>
required

Operation status.

Available options:
completed
I