Skip to main content
Give the CarHub Player SDK an ordered list of image URLs to display an interactive 360° spin on your site. If you also have a Player report, you can display inspection photos, panoramas, and damage markers.

Install

  1. Open the CarHub dashboard and go to API, MCP & SDKs → SDKs.
  2. Find Player SDK under Your SDKs and click Set up SDK.
  3. Choose Create project token and follow the guided npm setup. An organization owner or admin can create the token.
After setup, install the core package. Use version 1.0.2 or later for spins from frame URLs alone.
Keep the registry token in your package manager environment. Public frame URLs need no browser API key. The SDK supports modern evergreen browsers. It uses Shadow DOM, ResizeObserver, pointer events and AbortController.

Display a 360° spin

Add a container and provide frames as an array of image URLs in rotation order. The Player fills the container width and sets its height from the media’s aspect ratio.
Call player.destroy() when you remove the viewer. Try the same setup in the interactive Player demo.

Use frames from a CarHub 360° job

Submit render.360 with top-level public_output: true to keep generated frames available for a published listing. Endpoint access is sufficient to request public outputs. See public output files for quota and access requirements. Retrieve the completed job on your server with GET /v1/jobs/{id}. Extract the image URLs in rotation order and pass the array to spinFrames:
Public frames have image.expires_at: null and need no browser API key. Unpublishing the job revokes the public URLs for all its frames. Without public_output: true, download each image before its signed URL expires and serve lasting listings from your own storage. Keep your CarHub API key on your server.

Load report data

Pass Player-format JSON for inspection photos, panoramas, and damage markers. A CarHub inference job uses a different format. The CarHub Jobs API does not provide Player reports.
For the built-in loader, provide the URL of a compatible report service. It must return Player-format JSON for GET /reports/{token} and accept the credential as a bearer token.
The SDK defaults baseUrl to https://api.trycarhub.com/, but that API does not serve this report route. report takes precedence over token. When using a token, fetchReport takes precedence over the built-in loader. The current player package does not acquire SDK licenses automatically. See SDK licenses for the separate license API. If you supply a report jwt, the loader sends it as X-JWT and retries once without it on 401. Report JWTs and SDK license proofs serve separate purposes.
Browser users can read any apiKey supplied to the player. Keep secret CarHub API keys on your server and use report or fetchReport for private reports.

Configure the player

Pass configuration when you create the player. The defaults below apply unless you override them.
The available TabId values are 360, exterior, interior, interior360, others and damages.
Query parameters are off by default. Enable them when you want the SDK to follow the iframe embed contract. Query values then take precedence over supplied options, which take precedence over defaults.
For example, ?tabview=360&hotspot=false&excludeTab=interior,damages overrides the corresponding options.

Control the player

The instance exposes methods for navigation and playback.
showSlide() uses one global slide list, ordered exterior, interior, interior 360°, others and damages. The player automatically switches to the matching view. Read the active state with player.currentView, player.tabs, player.frame and player.currentReport.

Subscribe to events

Attach listeners immediately after creating the player. Initial events are emitted in a microtask, so the listener receives ready.
on, off and once are chainable. framechange can fire about 30 times a second during autoplay, so sample it before rendering UI from it.To replace sharing, prevent the default behavior:

Use a framework binding

The core player has bindings for React, Vue, and Angular. The React example below uses the same ordered frames array.
If you already have a Player report, you can use the custom element. Import it from your installed package and set the report before adding it to the page.
Its attributes mirror player options in kebab case. A bare boolean attribute enables the option. Set attribute="false" to disable it.

Theme and translate labels

Set CSS custom properties on the host element. They cross the Shadow DOM boundary.
Set data-theme="light" or data-theme="dark" on the host element to fix the theme. Without it, the player follows the user’s color-scheme preference.
The player converts damage and vehicle-part keys to readable labels by default. Use the optional i18n export for its five-language dictionary:
RICOH THETA equirectangular images use Photo Sphere Viewer. Install its optional peer dependencies to render them as interactive panoramas:
Without these packages, a panorama falls back to a flat image.
To replace an iframe, create a container and Player instance. Enable readQueryParams to preserve URL-driven configuration.