Widgets can call DeepSpace’s integration APIs to access external services — text generation, Google Calendar, web search, image processing, and more. All requests go through the mcapi client, which handles auth and (in canvas mode) user approval.
The mcapi Client
mcapi is the API client provided by the SDK. It handles authentication, environment detection, and the approval flow automatically.
import { mcapi } from '@spaces/sdk'
const result = await mcapi.post('generate-text', {
prompt: 'Write a haiku about coding',
})
You use mcapi.post(endpoint, body) or mcapi.get(endpoint). The client:
- Prepends the correct API base URL (auto-detected per environment)
- Attaches the user’s auth token
- In canvas mode, triggers the approval flow for credit-consuming endpoints
- Returns the response data
Free Endpoints
Some endpoints are auto-approved and never trigger the modal — typically read-only or non-credit-consuming routes like social profile lookups.
Standalone Mode
When a widget is deployed as a standalone site, there is no approval flow. API calls go directly to the server with the user’s auth token.
Available API Categories
The full list of endpoints with parameters is available at runtime via GET /api/integrations/routes-schema (returns JSON Schema) and GET /api/integrations/catalog.
AI & Content Generation
| Endpoint | Description |
|---|
generate-text | Text generation via LLMs |
generate-image | Image generation (async, auto-selects model) |
generate-image-classic | Fast image generation (Classic model) |
generate-image-mystic | Ultra-realistic images (Freepik Mystic) |
generate-image-flux-dev | Flux Dev model |
generate-image-flux-pro | Flux Pro v1.1 model |
generate-image-hyperflux | Hyperflux model |
generate-image-seedream | Seedream v3 model |
generate-image-seedream-v4 | Seedream v4 model |
generate-image-gpt | OpenAI GPT image models |
generate-video | Video generation from image + prompt |
text-to-speech | Convert text to audio |
speech-to-text | Transcribe audio to text |
submagic-create-video | AI video creation (async) |
Search & Research
| Endpoint | Description |
|---|
search-web-ai | Web search with custom AI prompt |
search-web | Web search with AI summarization |
search-web-raw | Web search (raw results) |
advanced-web-search | Multi-modal web search |
exa-search | Exa AI neural search |
exa-find-similar | Find similar pages via Exa |
exa-contents | Get full page contents for URLs |
exa-answer | LLM answer informed by Exa search |
exa-research | Async research task (up to 10 min) |
search-images | Image search |
search-videos | Video search |
search-pdfs | PDF document search |
search-academic | Academic content search (.edu) |
firecrawl-scrape | Scrape a single URL |
firecrawl-crawl | Crawl multiple URLs |
firecrawl-map | Map site structure |
firecrawl-search | Search crawled content |
scholar-search-papers | Google Scholar paper search |
scholar-search-authors | Google Scholar author search |
scholar-summarize-papers | Summarize papers via LLM |
scholar-get-citation-details | Get detailed citation info |
scholar-draft-email | Draft outreach email via LLM |
wikipedia-summary | Wikipedia page summary |
wikipedia-search | Search Wikipedia articles |
news-top-headlines | Top news headlines |
news-search | Search news articles |
Google Services
| Endpoint | Description |
|---|
google-calendar-events | List calendar events |
google-calendar-create-events | Create calendar events |
send-email | Send email via Gmail |
gmail-reply | Reply to Gmail threads |
drive-list | List Google Drive files |
drive-upload | Upload to Google Drive |
drive-download | Download from Google Drive |
drive-delete | Delete from Google Drive |
google-contacts | Fetch Google contacts |
Slack
| Endpoint | Description |
|---|
slack-channels | List Slack channels |
slack-send-message | Send a message |
slack-channel-history | Get channel message history |
slack-team-info | Get team information |
Image Processing
| Endpoint | Description |
|---|
remove-background | Remove image backgrounds |
upscale-image | Enhance image resolution |
style-transfer-image | Apply artistic styles from reference |
expand-image | Outpaint / extend image borders |
relight-image | Adjust lighting |
search-icons | Search Freepik icons |
download-icon | Download a Freepik icon |
search-stock-images | Search stock photos |
download-stock-image | Download a stock photo |
search-stock-videos | Search stock footage |
download-stock-video | Download stock footage |
Social & Professional
| Endpoint | Description |
|---|
linkedin-search-profiles | LinkedIn profile search |
linkedin-analyze-profiles | Analyze profiles for outreach |
linkedin-generate-messages | Generate outreach messages |
instagram-extract-content | Extract Instagram content |
tiktok-post-video | Post video to TikTok |
youtube-search | YouTube video search |
youtube-video-details | Get video details |
youtube-trending | Get trending videos |
github-search-repositories | Search GitHub repos |
github-get-repository | Get repo information |
github-get-repository-commits | Get repo commits |
github-get-repository-issues | Get repo issues |
github-get-repository-pulls | List pull requests |
github-get-repository-tree | Get file tree |
github-get-repository-contents | Get file/directory contents |
Data & Markets
| Endpoint | Description |
|---|
polymarket-events | Prediction market events |
polymarket-search | Full-text search events/markets |
polymarket-price-history | Historical price data |
polymarket-orderbook | Orderbook depth |
search-stocks | Search stock symbols |
search-crypto | Search cryptocurrencies |
amazon-search | Product search |
Sports
| Endpoint prefix | Description |
|---|
football/* | Soccer — leagues, teams, fixtures, standings, transfers, injuries, predictions |
basketball/* | Basketball — leagues, teams, games, standings, player stats |
nfl/* | American football — leagues, teams, games, standings, player stats |
baseball/* | Baseball — leagues, teams, games, standings |
f1-* | Formula 1 — schedules, standings, lap times, pit stops, qualifying, sprint |
Science, Weather & Travel
| Endpoint | Description |
|---|
weather-forecast | 5-day weather forecast |
current-weather | Current conditions |
geocode-city | Geocode a city name |
nasa-apod | Astronomy Picture of the Day |
nasa-neows-feed | Near-Earth Objects feed |
flights | Flight search (SerpAPI) |
serp-hotels | Hotel search |
serp-places | Place search |
serp-events | Event search |
mta-subway-arrivals | NYC subway real-time arrivals |
mta-subway-alerts | NYC subway service alerts |
Real-Time Communication
| Endpoint | Description |
|---|
livekit-create-room | Create a LiveKit video/audio room |
livekit-join-room | Join a room (get access token) |
livekit-list-participants | List room participants |
Widgets can discover other widgets on the same canvas without API calls:
window.parent.postMessage({ type: 'GET_CANVAS_WIDGETS' }, '*')
window.addEventListener('message', (event) => {
if (event.data.type === 'CANVAS_WIDGETS_RESPONSE') {
const widgets = event.data.widgets
// [{ id, shapeId, templateHandle, templateName, icon }, ...]
}
})
Widgets can be connected to each other via an input/output system. This lets data flow between widgets visually on the canvas.
- Outputs (red slot, right side) — A widget emits data
- Inputs (blue slot, left side) — A widget receives data
- Connections are drawn visually on the canvas and stored in canvas state
// Emit an output value
window.parent.postMessage({
type: 'widget-io-output-update',
slotId: 'output-1',
value: { data: computedResult },
}, '*')
// Listen for input values
window.addEventListener('message', (event) => {
if (event.data.type === 'widget-io-input-update') {
const { slotId, value } = event.data
// Use the incoming data
}
})
This system is useful for building pipelines — for example, a data-fetcher widget feeding into a chart widget.