Our API lets you transform any information - from documents to web pages - into structured data with just a few API calls.

Installation

First, install the Python client library:
pip install structifyai
We constantly push updates. Keep your client current with pip install structifyai --upgrade

Authentication

Get your API key from the Structify Dashboard and set it as an environment variable:
export STRUCTIFY_API_TOKEN="your_api_key"
Then import and initialize the client:
from structify import Structify

# Uses STRUCTIFY_API_TOKEN env var automatically
client = Structify()

# Or provide explicitly
client = Structify(api_key="your_api_key")

Create Your First Dataset

Let’s build a simple book and author dataset in three steps:

1. Define Your Schema

Create tables for authors and books, plus a relationship between them:
from structify import Structify
from structify.types.table import Table, Property
from structify.types.dataset_descriptor import Relationship

client = Structify()

# Define entity tables
tables = [
    Table(
        name="author",
        description="an individual who wrote a book",
        properties=[
            Property(name="name", description="The name of the author"),
            Property(name="genre", description="The genre the author typically writes in"),
            Property(name="birth_year", description="Year the author was born", prop_type="Integer")
        ]
    ),
    Table(
        name="book",
        description="a book that has been written",
        properties=[
            Property(name="title", description="The title of the book"),
            Property(name="publication_year", description="Year published", prop_type="Integer"),
            Property(name="copies_sold", description="Number of copies sold", prop_type="Integer")
        ]
    )
]

# Define relationships
relationships = [
    Relationship(
        name="authored_by",
        description="Connects a book to its author",
        source_table="book",
        target_table="author"
    )
]

# Create the dataset
client.datasets.create(
    name="books",
    description="Books and their authors",
    tables=tables,
    relationships=relationships
)

2. Add Initial Data

Add some authors to start with:
from structify.types import KnowledgeGraphParam, EntityParam

authors = ["J.K. Rowling", "Stephen King", "Harper Lee"]

for author_name in authors:
    client.entities.add(
        dataset="books",
        kg=KnowledgeGraphParam(
            entities=[
                EntityParam(
                    id=0,
                    type="author",
                    properties={"name": author_name}
                )
            ]
        )
    )

3. Enrich Your Dataset

Use Structify’s AI to find and add information:
# For each author, find their genre and books
for author in client.datasets.view_table(dataset="books", table="author"):
    # Fill in missing properties
    client.structure.enhance_property(
        entity_id=author.id,
        property_name="genre"
    )

    client.structure.enhance_property(
        entity_id=author.id,
        property_name="birth_year"
    )

    # Find books they've written
    client.structure.enhance_relationship(
        entity_id=author.id,
        relationship_name="authored_by"
    )

Complete Example

Here’s everything together in one script:
from structify import Structify
from structify.types import KnowledgeGraphParam, EntityParam
from structify.types.table import Table, Property
from structify.types.dataset_descriptor import Relationship

def create_book_dataset():
    client = Structify()

    # Step 1: Define schema
    tables = [
        Table(
            name="author",
            description="an individual who wrote a book",
            properties=[
                Property(name="name", description="The name of the author"),
                Property(name="genre", description="The genre the author typically writes in"),
                Property(name="birth_year", description="Year born", prop_type="Integer")
            ]
        ),
        Table(
            name="book",
            description="a book that has been written",
            properties=[
                Property(name="title", description="The title of the book"),
                Property(name="publication_year", description="Year published", prop_type="Integer"),
                Property(name="copies_sold", description="Copies sold", prop_type="Integer")
            ]
        )
    ]

    relationships = [
        Relationship(
            name="authored_by",
            description="Connects a book to its author",
            source_table="book",
            target_table="author"
        )
    ]

    # Create dataset
    client.datasets.create(
        name="books",
        description="Books and their authors",
        tables=tables,
        relationships=relationships
    )

    # Step 2: Add authors
    for author in ["J.K. Rowling", "Stephen King", "Harper Lee"]:
        client.entities.add(
            dataset="books",
            kg=KnowledgeGraphParam(
                entities=[EntityParam(id=0, type="author", properties={"name": author})]
            )
        )

    # Step 3: Enrich with AI
    for author in client.datasets.view_table(dataset="books", table="author"):
        client.structure.enhance_property(entity_id=author.id, property_name="genre")
        client.structure.enhance_relationship(entity_id=author.id, relationship_name="authored_by")

    print("Dataset created and enriched!")

    # View results
    results = client.datasets.view_table(dataset="books", table="author", limit=10)
    for author in results:
        print(f"Author: {author.properties['name']}, Genre: {author.properties.get('genre', 'Unknown')}")

if __name__ == "__main__":
    create_book_dataset()

What’s Next?

Now that you’ve created your first dataset, you can:

Key Capabilities

After reading our documentation, you’ll be able to:
  • Create personalized datasets of your professional network
  • Monitor changes in continuously updating datasets
  • Extract structured data from SEC filings and pitch decks
  • Automate notifications when new entities match your criteria
  • Build structured datasets from any unstructured data source