LogoLogo
DocsHomeSupportContact
  • Getting Started
    • Introduction
    • Build on DIMO
  • DEVELOPER GUIDE
    • Developer Overview
    • Developer Console
    • Authentication
    • DIMO Developer SDKs
      • Data SDK
      • Login with DIMO SDK
        • React Component
        • Login with DIMO Redirect
        • Core Functionalities
      • TypeScript: Transactions SDK
      • SDK Release Notes
    • Low Code Tools
      • n8n: Getting Started
    • Permissions Contract: SACD
    • DIMO Credits
    • Response Types
    • Rate Limits
    • Developer FAQ
    • Developer Changelogs
    • Troubleshooting Common Issues
  • API References
    • Overview of DIMO API
    • Attestation API
    • Device Definitions API
    • Identity API
      • Schema & Types
      • Scalars
      • Nodes & Objects
        • AftermarketDevice
        • AftermarketDeviceConnection
        • DCN
        • DCNConnection
        • DeveloperLicense
        • DeviceDefinition
        • Earning
        • EarningsConnection
        • Manufacturer
        • Sacd
        • SyntheticDevice
        • Vehicle
        • VehicleConnection
        • VehicleEarnings
        • UserRewards
      • Common Queries
    • Telemetry API
      • Schema & Types
      • Scalars
      • Nodes & Objects
        • Signals
        • SignalsLatest
      • Common Queries
    • Token Exchange API
    • Trips API
    • Valuations API
  • DIMO Hardware
    • Introduction
    • DIMO Hardware Application
    • DIMO Manufacturing License
    • Development & Certification
    • Audits & Assessments
      • Hardware & Security Audit
      • Customer Experience Assessment
      • Integration Testing & Quality Control
      • Final Approval
    • DIMO Device License
      • Device Minting Certificates
    • Essential Documents
      • Hardware & Security Audit Checklist
      • Approved Hardware Auditors
      • DIMO Memorandum of Understanding (MOU)
  • Additional References
    • Developer License
    • DIMO GraphQL Basics
  • Deprecated Resources
    • Guides
      • Developer Journey
      • Quick Start Guide
      • Hello World
      • Code Exchange Flow
    • Data Availability
Powered by GitBook
On this page
  • Overview
  • Getting Started
  • Using the SDK
  • Installation
  • Import
  • Initialization
  • Function Calls
  • Contributions

Was this helpful?

  1. DEVELOPER GUIDE
  2. Developer SDKs

TypeScript: Data SDK

Fetch vehicle data using Data SDK

Last updated 4 months ago

Was this helpful?

Overview

The DIMO Data SDK is an open-source TypeScript SDK built to facilitate developers in connecting to the API Services. The objective of the Data SDK is to handle things that interacts with the DIMO API.

Getting Started

To get started with the Data SDK, you should always start by defining which API your application is interested in using. Depending on what you want access to, you may need the following:

Using the SDK

Installation

npm install @dimo-network/data-sdk

Import

The SDK supports either import (ES Modules) or require (Common JS):

import { DIMO } from '@dimo-network/data-sdk';
const { DIMO } = require('@dimo-network/data-sdk/dist/index.cjs';

Initialization

const dimo = new DIMO('Production');

Function Calls

Getting a Developer JWT

// Call to get a Developer JWT
const auth = await dimo.auth.getToken({
  client_id: '<client_id>',
  domain: '<domain>',
  private_key: '<api_key>',
});

Getting a Vehicle JWT

// Call to get a Permissions JWT
await dimo.tokenexchange.exchange({
  ...auth,
  privileges: [1,3,4],
  tokenId: <vehicle_token_id>
});

Contributions

access_token: This should be the Developer's JWT. This uses the Developer License public credentials and the private key (API key) of the app. A developer would get this JWT on the backend through .

permissions_token: This is the 2nd layer of security around getting vehicle data. A developer would first need end users to grant permissions to the Developer License, and then get this JWT through . This is sometimes referred as privilege_token.

To learn more about the different JWTs and what they mean, visit the JWT section in .

Auth
Token Exchange
https://github.com/DIMO-Network/data-sdk/blob/master/CONTRIBUTING.md
npm: @dimo-network/data-sdknpm
Data SDK on NPM Registry
Logo
Authentication