> ## Documentation Index
> Fetch the complete documentation index at: https://docs.structify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Create your first dataset in three easy steps

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:

<CodeGroup>
  ```bash pip theme={null}
  pip install structifyai
  ```

  ```bash uv theme={null}
  uv pip install structifyai
  ```

  ```bash poetry theme={null}
  poetry add structifyai
  ```
</CodeGroup>

<Note>
  We constantly push updates. Keep your client current with `pip install structifyai --upgrade`
</Note>

## Authentication

Get your API key from the [Structify Dashboard](https://app.structify.ai) and set it as an environment variable:

```bash theme={null}
export STRUCTIFY_API_TOKEN="your_api_key"
```

Then import and initialize the client:

```python theme={null}
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:

```python theme={null}
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:

```python theme={null}
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:

```python theme={null}
# 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:

```python theme={null}
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:

<CardGroup cols={2}>
  <Card title="Explore Schema Design" icon="diagram-project" href="/schema-cookbook/schema-guidance">
    Learn best practices for designing schemas
  </Card>

  <Card title="Process Documents" icon="file-pdf" href="/guides/documents">
    Extract data from PDFs and documents
  </Card>

  <Card title="Web Scraping" icon="globe" href="/guides/web-extraction">
    Pull structured data from websites
  </Card>

  <Card title="View Examples" icon="code" href="/examples/company-intelligence">
    See real-world use cases
  </Card>
</CardGroup>

## 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
