Prerequisite: You need an API token to use Datascale’s API. Contact your account administrator or reach out to our team to get started.

Overview

Datascale’s API allows you to programmatically ingest and update your data assets, making it easy to keep your data lineage up-to-date as your systems evolve. This integration is perfect for:

  • Automating lineage updates as part of CI/CD pipelines
  • Syncing changes from version control systems
  • Building custom integrations with your internal tools

Authentication

All API requests require authentication using a Bearer token in the Authorization header:

Authorization: Bearer YOUR_TOKEN_HERE

Keep your API tokens secure and never expose them in client-side code or public repositories.

Integration Examples

import json, requests

# Configuration
url = "https://api.getdatascale.com/v1/ingest"
headers = {
    "Authorization": "Bearer YOUR_TOKEN_HERE",
    "Content-Type": "application/json"
}
body = {
    "content": "YOUR_SCRIPT_HERE",
    "platform": "",
    "extra_config": {}
}

# Send request
response = requests.put(url, headers=headers, json=body)

# Output response
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}")

Request Parameters

content
string
required

The SQL script, schema definition, or other content to be ingested. For SQL scripts, this should include CREATE TABLE statements, views, or other DDL/DML statements.

platform
string

The platform or database type the content is from. Examples include “snowflake”, “postgres”, “bigquery”, “redshift”, etc.

extra_config
object

Additional configuration options for processing the content.

Response Format

A successful API call will return a 200 status code and a JSON response with details about the ingested assets:

{
  "success": true,
  "message": "Successfully ingested 3 assets [1 added, 2 modified]",
}

Error Handling

If an error occurs, the API will return an appropriate HTTP status code and an error message:

{
  "success": false,
  "error": "Invalid syntax in SQL script",
  "details": "Error at line 15: Expected ';' but found ')'",
  "code": "PARSER_ERROR"
}

Common error codes include:

  • AUTHENTICATION_ERROR: Invalid or missing API token
  • PARSER_ERROR: Error parsing the provided content
  • INVALID_INPUT: Missing or invalid request parameters
  • SERVER_ERROR: Internal server error

Rate Limits

The API is rate-limited to 100 requests per 5-minute. If you exceed this limit, you’ll receive a 429 Too Many Requests status code.

Webhooks

For advanced integrations, Datascale supports webhooks that can notify your systems on custom events such as lineage updates or asset changes, or trigger your own workflows based on specific conditions. Contact our team to set up webhooks for your account.