---
title: Plain API Integration on Truto
slug: plain
category: Helpdesk
canonical: "https://truto.one/integrations/detail/plain/"
---

# Plain API Integration on Truto



**Category:** Helpdesk  
**Status:** Generally available

## MCP-ready AI tools

Truto exposes 19 tools for Plain that AI agents can call directly.

- **list_all_plain_me** — Get the Plain workspace this API key belongs to (myWorkspace).
- **list_all_plain_permissions** — List the permissions granted to this API key (myPermissions).
- **list_all_plain_customers** — List customers in the workspace, newest pages by cursor. Optional `filters` (CustomersFilter JSON).
- **get_single_plain_customer_by_id** — Get one customer by Plain customer ID.
- **create_a_plain_customer** — Create or update a customer (upsertCustomer). Body: `input` = UpsertCustomerInput (identifier {emailAddress | externalId | customerId}, onCreate {fullName, email {email, isVerified}, externalId}, onUpdate {}). Returns result CREATED/UPDATED/NOOP and the customer.
- **plain_customers_bulk_create** — Bulk import customers (importCustomers). Body: `input` = ImportCustomersInput (customers [{externalId, fullName, email, createdAt, tenants}]). Returns added/updated/skipped.
- **get_single_plain_customers_by_email_by_id** — Get a customer by email address (the id is the email).
- **get_single_plain_customers_by_external_id_by_id** — Get a customer by your external ID (the id is the external ID).
- **list_all_plain_threads** — List threads by cursor. Optional `filters` (ThreadsFilter JSON).
- **get_single_plain_thread_by_id** — Get one thread by Plain thread ID.
- **create_a_plain_thread** — Create a new thread for a customer (createThread), in TODO status. This is a normal new thread: like one made in Plain, it can start SLAs and autoresponders. To backfill history without that, use import. Body: `input` = CreateThreadInput: customerIdentifier (required: customerId, emailAddress or externalId), title, description, labelTypeIds, threadFields, assignedTo (userId or machineUserId), externalId, priority 0-3, accountIdentifier, channel (default API) and channelDetails (required for SLACK or MS_TEAMS). Returns the thread. Needs the thread:create and thread:read permissions.
- **plain_threads_import** — Import a historical thread (importThread). Sends nothing to the customer and starts no SLA or autoresponder. Body: `input` = ImportThreadInput: customerIdentifier, title, externalId, priority 0-3, status, statusDetail and createdAt (all required), plus description, externalUrl, labelTypeIds, assignedTo and tenantId. Returns `result` (CREATED or NOOP) and `thread`. A repeated externalId returns NOOP, possibly with no thread: find that thread with threads-by-external-id. Needs the thread:import permission.
- **list_all_plain_threads_by_external_id** — Find the thread with an external ID for one customer (threadByExternalId; external IDs are unique per customer). Query: `customer_id`, `external_id`. Returns zero or one thread.
- **plain_thread_messages_bulk_create** — Import up to 25 historical messages into a thread (importThreadMessages). Sends nothing to the customer. Body: `input` = ImportThreadMessagesInput (threadId, threadMessages [{author, text, format, createdAt, type INBOUND|OUTBOUND|NOTE, externalId, attachmentIds}]). A repeated message externalId returns NOOP.
- **create_a_plain_attachment_upload_url** — Create a pre-signed upload form for an attachment (createAttachmentUploadUrl). Body: `input` = CreateAttachmentUploadUrlInput (customerId, fileName, fileSizeBytes, attachmentType). POST the file as multipart/form-data to uploadFormUrl with uploadFormData, then reference attachment.id.
- **list_all_plain_label_types** — List label types. Optional `filters` (LabelTypeFilter JSON, e.g. {"isArchived": false}).
- **create_a_plain_label_type** — Create a label type (createLabelType). Body: `input` = CreateLabelTypeInput (name, externalId, color, icon).
- **list_all_plain_users** — List workspace users (agents). Optional `filters` (UsersFilter JSON).
- **get_single_plain_users_by_email_by_id** — Get a workspace user by email (the id is the email).

## How it works

1. **Link your customer's Plain account.** Use Truto's frontend SDK; we handle every OAuth and API key flow so you don't need to create the OAuth app.
2. **Authentication is automatic.** Truto refreshes tokens, stores credentials securely, and injects them into every API request.
3. **Call Truto's API to reach Plain.** The Proxy API is a 1-to-1 mapping of the Plain API.
4. **Get a unified response format.** Every response uses a single shape, with cursor-based pagination and data in the `result` field.

## Use cases

- **Embed AI-drafted responses into Plain threads** — AI customer support platforms can read historical thread context and silently push autonomous AI conversations into Plain as a transcript, giving human agents a complete audit trail without triggering SLAs or customer notifications.
- **Sync CRM and account health data into support context** — Customer success and CRM platforms can upsert customers into Plain by externalId and monitor thread volume per account, letting support agents see subscription tier and account health alongside every conversation.
- **Ship native in-app support inside your product** — SaaS platforms can replace generic chat widgets by using Plain's API to create threads directly from their own dashboard, CLI, or admin panel — delivering a fully white-labeled support experience backed by Plain's workflow engine.
- **Two-way issue tracker sync for engineering escalations** — Developer tool companies can link engineering issues to Plain threads so that when a bug is resolved, the associated customer thread is automatically updated with a reply — closing the loop between engineering and support.
- **Backfill historical conversations during migration** — Platforms helping customers migrate off legacy helpdesks can bulk-import threads and messages into Plain without triggering autoresponders, SLAs, or duplicate records — using idempotent externalId-based syncs.

## What you can build

- **Idempotent customer upsert pipeline** — Sync your user base into Plain using externalId or email with bulk create endpoints, so customer records stay in lockstep with your product database without duplicates.
- **Silent AI conversation logging** — Use thread import and bulk message creation to log full AI-agent transcripts into Plain as closed threads, bypassing SLAs and customer-facing notifications.
- **Live ticket creation from your app** — Fire create_a_plain_thread from your in-product support UI or CLI to open TODO-status threads that trigger Plain's assignment rules, SLAs, and autoresponders.
- **Pre-signed attachment uploads** — Generate upload URLs from Plain, POST files directly to storage, and attach the resulting attachment IDs to thread messages — avoiding heavy base64 payloads.
- **Dynamic label taxonomy sync** — Programmatically create Plain label types with matching names, hex colors, and icons so your product categories map cleanly to Plain threads for automated tagging.
- **Account-level thread analytics** — Query threads by externalId to detect spikes in high-priority conversations per customer and surface at-risk accounts inside your CS or analytics product.

## FAQs

### How does Truto handle authentication with Plain?

Truto manages the Plain API key securely on behalf of each of your end users. Your product never stores or sees the credentials — Truto handles token storage, refresh, and injection into every API call.

### What's the difference between creating a thread and importing a thread?

create_a_plain_thread opens a live TODO thread that triggers SLAs, assignment rules, and customer autoresponders — ideal for real user requests. plain_threads_import is silent: it backfills history or logs AI conversations without triggering notifications, making it safe for migrations and bulk syncs.

### How do I prevent duplicate customers or threads during bulk sync?

Plain's API is designed for idempotent upserts via externalId. If you pass an externalId that already exists, Plain returns a NOOP result instead of creating a duplicate — so you can safely retry or re-run syncs without side effects.

### How are file attachments handled?

You call create_a_plain_attachment_upload_url to get a pre-signed URL, POST the file directly as multipart/form-data, then attach the returned attachment.id to a thread message. Truto proxies the URL generation but the file upload goes directly to Plain's storage.

### Can I look up a customer without knowing Plain's internal ID?

Yes. Truto exposes get_single_plain_customers_by_email_by_id and get_single_plain_customers_by_external_id_by_id, so you can resolve customers using the identifiers you already have in your own system.

### Can I create custom labels programmatically?

Yes. Use create_a_plain_label_type to define new label types with custom names, hex colors, and icons, then apply them to threads to mirror your product's own categorization taxonomy.

### Is the integration real-time or polling-based?

Reads via list and get endpoints are on-demand. For writes (creating threads, messages, customers, labels), changes are reflected in Plain immediately. Truto's sync configuration lets you control polling cadence for reads based on your freshness needs.
