Skip to main content
Create tickets in Typewise by posting to the Form API. Use this when an external system (Salesforce, an internal tool, a webhook) needs to open a ticket programmatically.
You need an API key. Get it from Behavior → Channels → Email → Settings.
If you have a backend, send requests from there to keep your API key private. Client-side usage (e.g. from Webflow) works fine — you can regenerate the key at any time if needed.

Endpoint

POST https://platform-api.typewise.app/api/emails/form
Authentication (use either):
  • Header: Authorization: Bearer YOUR_API_KEY
  • Query parameter: ?apiKey=YOUR_API_KEY

Quick start

const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://platform-api.typewise.app/api/emails/form";

const form = new FormData();
form.append("message", "Customer message body here");
form.append("email", "customer@example.com");
form.append("variables.subject", "Order issue #12345");
form.append("variables.name", "Jane Doe");

fetch(BASE_URL, {
  method: "POST",
  headers: { Authorization: `Bearer ${API_KEY}` },
  body: form,
})
  .then(async (response) => {
    const body = await response.json();
    console.log(response.status, body);
  })
  .catch((error) => {
    console.error("Error:", error);
  });
application/json is also accepted if you prefer — send a JSON body with message, email, and a variables object. FormData is recommended because it also supports file attachments.

Response

Success (200):
{ "success": true }
Errors:
StatusBodyCause
401{ "error": "Unauthorized" }Missing API key
500Server errorInvalid or expired API key
400Validation errorMissing message or invalid email
429Rate limitToo many requests

Fields

Required

FieldDescription
messageThe ticket body
emailEnd customer email address
FieldDescription
variables.subjectTicket subject line (shown in portal and email threads)
variables.nameCustomer display name

Attachments

Append one or more files as attachments fields:
form.append("attachments", file1, "invoice.pdf");
form.append("attachments", file2, "receipt.pdf");

Custom variables

Any field prefixed with variables. is stored on the ticket and visible to agents in the portal.
form.append("variables.orderId", "ORD-98765");
form.append("variables.priority", "high");

Salesforce integration

Link Typewise tickets to Salesforce cases so resolution syncs back to your CRM.
The Form API works without Salesforce connected. To sync resolved tickets back to Salesforce, connect it via Salesforce OAuth.

Case ID

Pass your Salesforce Case ID (18-character format) as variables.crmTicketId. This field controls what happens when the ticket resolves:
  • With crmTicketId — Typewise updates the existing Salesforce case
  • Without crmTicketId — Typewise creates a new Salesforce case

Display fields

These variables appear in the agent portal for reference. They don’t affect sync.
FieldExample
variables.Salesforce Ticket ID500d200002SGATiAAP
variables.Salesforce Case Number00001772

Example

Add these fields to the quick start script:
const SF_CASE_ID = "500d200002SGATiAAP";

form.append("variables.crmTicketId", SF_CASE_ID);
form.append("variables.Salesforce Ticket ID", SF_CASE_ID);
form.append("variables.Salesforce Case Number", "00001772");
form.append("variables.subject", "Case: Billing inquiry #00001772");

See also