Documentation

ThinkMaterial provides powerful APIs that enable seamless integration with your existing systems, applications, and workflows. This documentation covers our API offerings, authentication methods, and best practices for integration.

API Overview

ThinkMaterial offers multiple interface options to accommodate different integration needs:

REST API

Our RESTful API provides comprehensive access to ThinkMaterial's capabilities through standard HTTP methods:

  • Base URL: https://api.turingai.cc/v1
  • Format: JSON
  • Rate Limits: 1000 requests per minute (contact us for higher limits)

GraphQL API

For more complex operations and flexible data querying:

  • Endpoint: https://api.turingai.cc/graphql
  • Advantages: Request exactly the data you need, combine multiple operations in a single request
  • Includes: Built-in schema introspection and documentation

WebSocket API

For real-time updates and streaming data:

  • Endpoint: wss://api.turingai.cc/v1/ws
  • Use Cases: Live experiment monitoring, real-time collaboration, notifications

Authentication

All API calls require authentication using one of the following methods:

API Keys

For server-to-server integration:

curl -X GET "https://api.turingai.cc/v1/materials" \
  -H "X-API-Key: your_api_key"

OAuth 2.0

For user-context operations and third-party applications:

  1. Redirect users to: https://turingai.cc/oauth/authorize
  2. Receive callback with authorization code
  3. Exchange for access token at: https://api.turingai.cc/oauth/token
  4. Use the token in API requests:
curl -X GET "https://api.turingai.cc/v1/experiments" \
  -H "Authorization: Bearer your_access_token"

Core API Services

Knowledge API

Access and query ThinkMaterial's knowledge graph:

Prediction API

Generate property predictions and simulations:

Experimental API

Design and manage experiments:

Collaboration API

Enable team coordination and data sharing:

SDKs and Client Libraries

For convenient integration, we provide client libraries in multiple languages:

Webhooks

Configure event-driven integrations using webhooks:

  • Endpoint: Define your callback URL in the developer dashboard
  • Events: Subscribe to specific events (experiment completion, prediction updates, etc.)
  • Security: Webhook payloads are signed for verification

Data Exchange Formats

ThinkMaterial supports various data exchange formats:

  • Chemical Formats: CIF, MOL, PDB, SMILES, InChI
  • Experimental Data: CSV, HDF5, JSON
  • Computational Results: POSCAR, CONTCAR, OUTCAR (VASP), CML
  • Imaging: Standard formats (PNG, JPEG) and microscopy-specific formats

Integration Examples

Laboratory Equipment Integration

from thinkmaterial import ExperimentalAPI
 
# Connect to an XRD instrument
api = ExperimentalAPI(api_key="your_api_key")
instrument = api.connect_instrument(
    instrument_type="XRD",
    connection_params={
        "ip_address": "192.168.1.100",
        "port": 8080,
        "protocol": "EPICS"
    }
)
 
# Configure and run a measurement
measurement = instrument.create_measurement(
    sample_id="SAMPLE-123",
    parameters={
        "scan_range": [10, 80],
        "step_size": 0.02,
        "count_time": 1.0
    }
)
 
# Start measurement and receive results
result = measurement.execute()
api.process_result(result)

LIMS Integration

const { KnowledgeAPI } = require('thinkmaterial');
 
// Initialize the API
const api = new KnowledgeAPI({
  apiKey: 'your_api_key'
});
 
// Sync sample data from LIMS
async function syncSamplesFromLIMS() {
  const limsClient = new LIMSConnector({
    url: 'https://your-lims-server.com/api',
    credentials: { /* your LIMS credentials */ }
  });
  
  const samples = await limsClient.getSamples({ 
    dateRange: { from: '2023-01-01', to: '2023-01-31' } 
  });
  
  // Import samples to ThinkMaterial
  const result = await api.materials.batchImport({
    materials: samples.map(sample => ({
      externalId: sample.id,
      name: sample.name,
      composition: sample.composition,
      properties: sample.properties,
      metadata: {
        source: 'LIMS',
        timestamp: new Date().toISOString()
      }
    }))
  });
  
  return result;
}

Rate Limits and Quotas

  • Standard tier: 1,000 requests/minute, 1,000,000 requests/month
  • Professional tier: 5,000 requests/minute, 5,000,000 requests/month
  • Enterprise tier: Custom limits based on requirements

Exceeding rate limits results in 429 Too Many Requests responses with appropriate retry-after headers.

Best Practices

  • Use GraphQL for complex data fetching to minimize request count
  • Implement exponential backoff for retries
  • Store and reuse immutable results when possible
  • Use webhooks for event-driven architecture instead of polling
  • Consider data volume when designing batch operations

Support

For API support and assistance:

Next Steps