Altan
HomeDiscordStatus
HomeDiscordStatus
  1. Databases
  • What is Altan?
  • Apps
    • Create Your First App
    • App Navigation & Settings
    • Building Tips
    • The Art of Prompting
    • Add Media to Your App
    • Publishing Your App
    • Rollback and Checkpoints
    • Instantly Resolve Errors
  • Flows
    • Create your first Flow
    • Automation basics
    • Adding modules
    • Types of modules
    • Passing data
    • Filters
    • Debugging
    • Retrigger events
    • Version History
    • Overwrite connection
    • Task credits
  • Databases
    • Introduction
    • Records
  • AI Agents
    • What is an AI Agent?
    • Create your first AI Agent
    • Tools
    • Interacting with Your AI Agent
  • Integration
    • Magic Link
    • Altan Integrator
    • Create your integration
  • Creators
    • What is Altan Creators?
    • How it works
  • Get Support
    • Support Options
  1. Databases

Records

The Record API in Altan allows users to create, query, update, and delete records efficiently. This guide focuses on querying records, ensuring you understand how to filter, sort, and paginate results.
You must pass the db_field_name not the field name to create, update or query records.

Creating Records#

To create records, send a POST request to:

Request Body:#

{
  "records": [
    {
      "fields": {
        "name": "John Doe",
        "email": "john@example.com",
        "age": 30
      }
    }
  ]
}

Response:#

{
  "records": [
    {
      "id": "rec123",
      "fields": {
        "name": "John Doe",
        "email": "john@example.com",
        "age": 30
      },
      "created_time": "2025-02-04T12:00:00Z"
    }
  ]
}

Querying Records#

Use the POST method to query records dynamically with filtering, sorting, and pagination.

Request Body:#

{
  "filters": [
    { "field": "age", "operator": "gte", "value": 25 }
  ],
  "sort": [
    { "field": "created_time", "direction": "desc" }
  ],
  "fields": ["name", "email"],
  "limit": 10,
  "page_token": null
}

Response:#

{
  "total": 100,
  "records": [
    {
      "id": "rec456",
      "fields": {
        "name": "Jane Doe",
        "email": "jane@example.com"
      }
    }
  ],
  "next_page_token": "abc123"
}

Searching Records#

Perform a GET request with a search query.

Response:#

{
  "records": [
    {
      "id": "rec789",
      "fields": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    }
  ]
}

Fetching a Single Record#

Retrieve a specific record by ID.

Response:#

{
  "record": {
    "id": "rec123",
    "fields": {
      "name": "John Doe",
      "email": "john@example.com",
      "age": 30
    }
  }
}

Updating Records#

Update records partially or completely.

Request Body:#

{
  "records": [
    {
      "id": "rec123",
      "fields": { "age": 31 }
    }
  ]
}

Response:#

{
  "records": [
    {
      "id": "rec123",
      "fields": { "age": 31 }
    }
  ]
}

Deleting Records#

Delete one or multiple records by ID.

Request Body:#

{
  "record_ids": ["rec123", "rec456"]
}

Response:#

{
  "msg": "Records deleted successfully"
}

Conclusion#

The Altan Record API provides powerful querying capabilities with flexible filtering, sorting, and pagination. Use it to manage data efficiently within your Altan database.
Modified at 2025-02-04 20:50:20
Previous
Introduction
Next
What is an AI Agent?
Built with