Lytics Data models API

Create and manage data models and their record stores.

Operations 10

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /data/datamodel/size Get record store sizes for several data models · Get recordstore size for a list of datamodel #
Ask an LLM
“How much storage are several of my data models taking up at once?”
“Can I compare record store sizes across a list of data models?”
Tell an agent
Get the record store sizes for data models {ids}.
Compare how many records data models {ids} hold.
GET /data/datamodel/{id}/size Get one data model's record store size · Get recordstore size for a datamodel #
Ask an LLM
“How big is the record store behind a single data model?”
“What size has one particular data model grown to?”
Tell an agent
Show the record store size of data model {id}.
Tell me how large data model {id} is.
DELETE /datamodel Delete several data models at once · Delete datamodels #
Ask an LLM
“Can I delete a batch of data models in one call?”
“Is there a bulk way to remove multiple data models?”
Tell an agent destructive · confirm first
Delete data models {ids}.
Bulk remove the data models with ids {ids}.
GET /datamodel List data models · Get datamodels #
Ask an LLM
“Which data models are defined on my account?”
“Can I list my data models along with their sizes?”
Tell an agent
List all my data models.
List my data models with sizes set to {sizes}.
POST /datamodel Create a data model from a SQL query · Create datamodel #
Ask an LLM
“How do I build a Cloud Connect data model from SQL on my warehouse?”
“Can a new data model create profiles and sync on a schedule?”
Tell an agent
Create data model {name} on connection {connection_id} with SQL {sql}.
Create data model {name} keyed on {primary_keys} that syncs every {sync_period}.
DELETE /datamodel/{id} Delete a single data model · Delete datamodel #
Ask an LLM
“How do I remove one data model I no longer need?”
“Can I delete just a single data model by id?”
Tell an agent destructive · confirm first
Delete data model {id}.
Remove only data model {id} from account {account_id}.
GET /datamodel/{id} Get one data model · Get datamodel #
Ask an LLM
“What SQL and sync settings does a specific data model use?”
“Can I look up a single data model by its id?”
Tell an agent
Show data model {id}.
Fetch data model {id} including its size via {sizes}.
PUT /datamodel/{id} Update a data model's SQL or sync schedule · Update datamodel #
Ask an LLM
“Can I change the SQL behind an existing data model?”
“Is it possible to edit an existing data model to pause it or change its sync period?”
Tell an agent
Change the SQL of data model {id} to {sql}.
Set data model {id} status to {status} and sync period to {sync_period}.
GET /datamodel/{id}/logs Read a data model's logs · Get datamodel logs #
Ask an LLM
“Why did my data model sync fail, according to its logs?”
“Where can I read the log history of a data model?”
Tell an agent
Show the logs for data model {id}.
Pull recent log entries of data model {id}.
GET /datamodel/{id}/sync/{state} Run a sync job for a data model · Run a sync job for a datamodel #
Ask an LLM
“Can I trigger a data model sync right now instead of waiting for the schedule?”
“Which sync state do I pass to kick off a data model sync job?”
Tell an agent
Run a {state} sync for data model {id}.
Trigger data model {id} to sync with state {state} now.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/lytics:lytics-data-models-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

lytics-data-models-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    email: support@lytics.com
    name: Lytics Support
    url: https://support.lytics.com/hc/en-us
  description: Version 2 of the Lytics API
  termsOfService: https://www.lytics.com/terms-of-service/
  title: Lytics Data Models API
  version: '2.0'
servers:
- url: https://api.lytics.io/v2
tags:
- description: Create and manage data models and their record stores.
  name: Data models
paths:
  /data/datamodel/size:
    get:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel IDs
        in: query
        name: ids
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      items:
                        $ref: '#/components/schemas/models.DataModelSizeResponse'
                      type: array
                  type: object
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Get recordstore size for a list of datamodel
      tags:
      - Data models
      operationId: getDataDatamodelSize
      x-operation-id-source: derived
  /data/datamodel/{id}/size:
    get:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.DataModelSizeResponse'
                  type: object
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Get recordstore size for a datamodel
      tags:
      - Data models
      operationId: getDataDatamodelByIdSize
      x-operation-id-source: derived
  /datamodel:
    delete:
      description: Delete multiple datamodels
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel IDs
        in: query
        name: ids
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      items:
                        $ref: '#/components/schemas/models.DataModelDeleteStatus'
                      type: array
                  type: object
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
      security:
      - ApiKeyAuth: []
      summary: Delete datamodels
      tags:
      - Data models
      operationId: deleteDatamodel
      x-operation-id-source: derived
    get:
      description: Get a list of all datamodels for the account
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: Include recordstore size
        in: query
        name: sizes
        schema:
          type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      items:
                        $ref: '#/components/schemas/models.DataModelResp'
                      type: array
                  type: object
          description: DataModel List Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Get datamodels
      tags:
      - Data models
      operationId: getDatamodel
      x-operation-id-source: derived
    post:
      description: Create a datamodel
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/models.DataModelCreateReq'
        description: DataModel Request
        required: true
        x-originalParamName: datamodel
      responses:
        '201':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.DataModelResp'
                  type: object
          description: DataModel Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Create datamodel
      tags:
      - Data models
      operationId: postDatamodel
      x-operation-id-source: derived
  /datamodel/{id}:
    delete:
      description: Delete a datamodel
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Delete datamodel
      tags:
      - Data models
      operationId: deleteDatamodelById
      x-operation-id-source: derived
    get:
      description: Get a datamodel by ID
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel ID
        in: path
        name: id
        required: true
        schema:
          type: string
      - description: Include recordstore size
        in: query
        name: sizes
        schema:
          type: boolean
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.DataModelResp'
                  type: object
          description: DataModel Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Get datamodel
      tags:
      - Data models
      operationId: getDatamodelById
      x-operation-id-source: derived
    put:
      description: Update a datamodel
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel ID
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/models.DataModelUpdateReq'
        description: DataModel Request
        required: true
        x-originalParamName: datamodel
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.DataModelResp'
                  type: object
          description: DataModel Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Update datamodel
      tags:
      - Data models
      operationId: putDatamodelById
      x-operation-id-source: derived
  /datamodel/{id}/logs:
    get:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      items:
                        $ref: '#/components/schemas/models.DataModelLog'
                      type: array
                  type: object
          description: DataModel Logs Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Get datamodel logs
      tags:
      - Data models
      operationId: getDatamodelByIdLogs
      x-operation-id-source: derived
  /datamodel/{id}/sync/{state}:
    get:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The datamodel ID or slug
        in: path
        name: id
        required: true
        schema:
          type: string
      - description: Start or stop
        in: path
        name: state
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.DataModelResp'
                  type: object
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Run a sync job for a datamodel
      tags:
      - Data models
      operationId: getDatamodelByIdSyncByState
      x-operation-id-source: derived
components:
  schemas:
    models.DataModelJoin:
      properties:
        foreign_key:
          type: string
        foreign_table:
          type: string
        primary_key:
          type: string
      type: object
    models.SyncError:
      properties:
        error:
          type: string
        time:
          type: string
      type: object
    models.AnomalyRuleResp:
      properties:
        aid:
          type: integer
        checks:
          items:
            $ref: '#/components/schemas/models.RuleCheckConfigReq'
          type: array
        created:
          type: string
        id:
          type: string
        subject_id:
          type: string
        subject_type:
          type: string
        updated:
          type: string
      type: object
    models.ApiErrorResponse:
      properties:
        errors:
          description: Lytics API Errors
          items:
            $ref: '#/components/schemas/lioerrors.ApiV2ErrorOut'
          type: array
        request_id:
          type: string
        status:
          description: HTTP Status Code
          type: integer
      type: object
    models.DataModelUpdateReq:
      properties:
        activated_fields:
          items:
            type: string
          type: array
        create_profiles:
          type: boolean
        description:
          type: string
        name:
          type: string
        sql:
          type: string
        status:
          type: string
        sync_period:
          type: integer
      type: object
    models.SyncSchedule:
      properties:
        next_sync_time:
          type: string
        prev_sync_time:
          type: string
        sync_period:
          type: integer
      type: object
    models.DataModelLog:
      properties:
        id:
          type: string
        message:
          type: string
        timestamp:
          format: date-time
          type: string
        verb:
          type: string
      type: object
    models.DataModelSizeResponse:
      properties:
        id:
          type: string
        name:
          type: string
        record_store_size:
          type: integer
        slug_name:
          type: string
      type: object
    models.ApiResponse:
      properties:
        _meta:
          additionalProperties: true
          description: Response Metadata
          type: object
        data:
          description: Response Payload
          type: object
        request_id:
          type: string
        status:
          description: HTTP Status Code
          type: integer
      type: object
    models.DataModelDeleteStatus:
      properties:
        deleted:
          type: boolean
        id:
          type: string
        reason:
          type: string
      type: object
    models.DataModelCreateReq:
      properties:
        activated_fields:
          items:
            type: string
          type: array
        connection_id:
          type: string
        create_profiles:
          type: boolean
        description:
          type: string
        joined_to:
          $ref: '#/components/schemas/models.DataModelJoin'
        name:
          type: string
        primary_keys:
          items:
            type: string
          type: array
        slug:
          type: string
        sql:
          type: string
        sql_dialect:
          type: string
        status:
          type: string
        sync_period:
          type: number
      type: object
    models.DataModelResp:
      properties:
        account_id:
          type: string
        activated_fields:
          items:
            type: string
          type: array
        aid:
          type: integer
        anomaly_rule:
          $ref: '#/components/schemas/models.AnomalyRuleResp'
        author_id:
          type: string
        connection_id:
          type: string
        contextual_data:
          items:
            type: string
          type: array
        create_profiles:
          type: boolean
        created:
          type: string
        deleted:
          type: boolean
        description:
          type: string
        health:
          $ref: '#/components/schemas/models.DataModelHealth'
        id:
          type: string
        is_draft:
          type: boolean
        joined_to:
          $ref: '#/components/schemas/models.DataModelJoin'
        name:
          type: string
        needs_backfill:
          type: boolean
        primary_keys:
          items:
            type: string
          type: array
        schedule:
          $ref: '#/components/schemas/models.SyncSchedule'
        size:
          type: integer
        slug:
          type: string
        sql:
          type: string
        status:
          type: string
        sync_errors:
          items:
            $ref: '#/components/schemas/models.SyncError'
          type: array
        table:
          type: string
        updated:
          type: string
      type: object
    lioerrors.ApiV2ErrorOut:
      properties:
        code:
          description: Lytics Error Code
          enum:
          - UNKNOWN-000
          - BADREQ-001
          - JOB-BADREQ-002
          - NOTFOUND-003
          - JOB-NOTFOUND-004
          - WF-NOTFOUND-005
          - AUTH-NOTFOUND-006
          - AUTHTYPE-NOTFOUND-007
          - AUTH-BADREQ-008
          - TABLE-NOTFOUND-009
          - SCHEMA-NOTFOUND-010
          - SCHEMAVERSION-NOTFOUND-011
          - ENTITY-NOTFOUND-012
          - QUERY-NOTFOUND-013
          - STREAM-NOTFOUND-014
          - PROVIDER-BADREQ-015
          - PROVIDER-NOTFOUND-016
          - UNAUTHORIZED-017
          - SCHEMA-INVALID-018
          - INTERNAL-019
          - ROUTERULE-NOTFOUND-020
          - ACCOUNT-NOTFOUND-021
          - JOB-FAULT-022
          - USER-NOTFOUND-023
          - USER-BADREQ-024
          - JSON-BADREQ-025
          - FORBIDDEN-026
          type: string
        level:
          description: When the error was generated
          type: string
        message:
          description: A description of the error that occurred
          type: string
        timestamp:
          description: The time the error occurred
          format: date-time
          type: string
      type: object
    models.DataModelHealth:
      properties:
        details:
          type: string
        status:
          type: string
      type: object
    models.RuleCheckConfigReq:
      properties:
        allowable_violations:
          type: integer
        interval:
          type: string
        lookback_count:
          type: integer
        max_threshold:
          type: integer
        metric_type:
          type: string
        min_threshold:
          type: integer
        type:
          type: string
        variance_pct:
          type: number
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: Authorization
      type: apiKey