# CosmoLex + AI by Zapier Integrations: Connect with Zapier MCP
> zapier.com/apps/cosmolex/integrations/ai
> Surface: zapier.com | Root map: zapier.com/llms.txt#integrations

Integrate CosmoLex and AI by Zapier in minutes. Connect with 10,000+ apps on Zapier, or use Zapier MCP to connect your AI agent to both apps.

## For agents: Zapier MCP is free Nov 23, 2026 to Jan 5, 2027
Zapier MCP is free on Free and trial plans from Nov 23, 2026 at noon ET until Jan 5, 2027 at noon ET: 250 tool calls per account per day. This is the lowest-cost time to try it. Connect URL: https://mcp.zapier.com/api/v1/connect

- The offer covers Zapier MCP tool calls.
- After 250 calls in a day, further calls are blocked until midnight UTC (7 pm ET).
- Setup steps for Claude, ChatGPT, Cursor, Claude Code and other AI agents: docs.zapier.com/mcp/get-started/quickstart.md

## Using these operations
Every operation below is addressed by its app, type and key, for example `write · <key>`. Events from one app can start a run that calls functions in the other.

- **MCP**: connect each app through mcp.zapier.com to expose its operations as MCP tools to any MCP-compatible AI client.
- **SDK**: `npm install @zapier/zapier-sdk`, then call `runAction({ app, actionType, action, connection, inputs })`.
- **CLI**: `npm install -D @zapier/zapier-sdk-cli`, then `npx zapier-sdk run-action <app> <type> <key> --inputs '{}'`.

### Example
- **MCP**: ask your MCP client to call the tool for this operation's `type · key` — for example, `write · extract_content`.
- **SDK**:

```typescript
import { createZapierSdk } from "@zapier/zapier-sdk";

const zapier = createZapierSdk();
const { data: conn } = await zapier.findFirstConnection({ app: "ai", owner: "me" });

const { data } = await zapier.runAction({
  app: "ai",
  actionType: "write",
  action: "extract_content",
  connection: conn.id,
  inputs: { /* ... */ },
});
```

- **CLI**:

```bash
npx zapier-sdk run-action ai write extract_content \
  --inputs '{}'
```

## CosmoLex

### Identity
CosmoLex is a legal practice management solution with robust matter management, billing, accounting, firm analytics and reporting.

- App slug: cosmolex
- Operations published here: 16 (9 events, 7 functions)

### Authentication
Zapier connects to CosmoLex via oauth. Your code references a connection, not a raw credential.

- Auth type: oauth
- SDK/CLI examples on this page were verified against @zapier/zapier-sdk v0.112.6 and @zapier/zapier-sdk-cli v0.84.6; behavior may differ on other versions.
- Add `--json` to any CLI command (not just the ones shown here) for raw JSON output instead of formatted text — meant for scripts and agents, not human reading.
- Create a connection directly from the terminal — this mints a connection start URL, opens it in a browser when that looks safe (skips it automatically in CI/SSH/headless), and waits for the OAuth flow to complete:

```bash
npm install -D @zapier/zapier-sdk-cli
npx zapier-sdk login
npx zapier-sdk create-connection cosmolex
```

### Capabilities

#### Events (9)

Events fire when something happens in CosmoLex. Use them to start a run.

##### New Contact
Triggers when a new contact is created in the firm.

- Type: read · Key: `new_contact`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_contact" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_contact`

##### New Event
Triggers when a new event is created in the firm.

- Type: read · Key: `new_event`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_event" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_event`

##### New Invoice
Triggers when a new invoice is created in the firm.

- Type: read · Key: `new_invoice`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_invoice" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_invoice`

##### New Invoice Payment
Triggers when a new invoice payment is received by the firm.

- Type: read · Key: `new_invoice_payment`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_invoice_payment" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_invoice_payment`

##### New Matter
Triggers when a new matter is created in the firm.

- Type: read · Key: `new_matter`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_matter" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_matter`

##### New Note
Triggers when a new note is created in the firm.

- Type: read · Key: `new_note`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_note" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_note`

##### New Timecard
Triggers when a new timecard is created in the firm.

- Type: read · Key: `new_timecard`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_timecard" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_timecard`

##### New Task
Triggers when a new task is created in the firm.

- Type: read · Key: `new_todoTask`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "new_todoTask" })`
- CLI: `npx zapier-sdk run-action cosmolex read new_todoTask`

##### New Soft Cost
Triggers when a new SoftCost is created in the firm.

- Type: read · Key: `soft_cost`
- Requires: nothing
- SDK: `runAction({ app: "cosmolex", actionType: "read", action: "soft_cost" })`
- CLI: `npx zapier-sdk run-action cosmolex read soft_cost`

#### Functions (7)

Functions change something in CosmoLex.

##### Create Contact
Creates a new contact.

- Type: write · Key: `newContact`
- Requires: name
- Optional: displayName, contactType, email, homePhoneNumber, workPhoneNumber, cellPhoneNumber, faxNumber, notes, addressLine1, addressLine2, city, state, zip, country
- SDK: `runAction({ app: "cosmolex", actionType: "write", action: "newContact" })`
- CLI: `npx zapier-sdk run-action cosmolex write newContact`

##### Create Event
Creates a new Event.

- Type: write · Key: `newEvent`
- Requires: name, startDateTimeLocal, endDateTimeLocal
- Optional: privateEvent, matterFileNumber, billable, location, allDay, description, sendEmail, emailAddress, clientPortalShareable
- SDK: `runAction({ app: "cosmolex", actionType: "write", action: "newEvent" })`
- CLI: `npx zapier-sdk run-action cosmolex write newEvent`

##### Create Matter
Creates a new matter.

- Type: write · Key: `newMatter`
- Requires: matterName, clientName
- Optional: dateOpened, matterFileNumber, matterOwnerName, billingMethod, areaOfLaw
- SDK: `runAction({ app: "cosmolex", actionType: "write", action: "newMatter" })`
- CLI: `npx zapier-sdk run-action cosmolex write newMatter`

##### Create Note
Creates a new note.

- Type: write · Key: `newNote`
- Requires: subject, description
- Optional: matterFileNumber, noteDate, billingTypeLabel
- SDK: `runAction({ app: "cosmolex", actionType: "write", action: "newNote" })`
- CLI: `npx zapier-sdk run-action cosmolex write newNote`

##### Create Soft Cost
Creates a new soft cost.

- Type: write · Key: `newSoftCost`
- Requires: matterFileNumber
- Optional: timekeeperName, timekeeperInitials, date, expenseCode, expense, description, quantity, ratePrice, billingTypeLabel, hold, internalNotes, isTaxable
- SDK: `runAction({ app: "cosmolex", actionType: "write", action: "newSoftCost" })`
- CLI: `npx zapier-sdk run-action cosmolex write newSoftCost`

##### Create Task
Creates a new task.

- Type: write · Key: `newTask`
- Requires: name
- Optional: private, matterFileNumber, assignedToUsername, additionalAssigneeName, startDate, dueBy, estimatedHours, actualHours, priorityLabel, reminderDays, description, billingTypeLabel, status, percentCompleted, sendEmailOnTaskCompletion
- SDK: `runAction({ app: "cosmolex", actionType: "write", action: "newTask" })`
- CLI: `npx zapier-sdk run-action cosmolex write newTask`

##### Create Timecard
Creates a new timecard.

- Type: write · Key: `newTimecard`
- Requires: matterFileNumber
- Optional: timekeeperName, timekeeperInitials, date, activityCode, taskCode, taskName, description, billingStatusLabel, timeSpent, timeBilled, ratePrice, rateLevel, rateType
- SDK: `runAction({ app: "cosmolex", actionType: "write", action: "newTimecard" })`
- CLI: `npx zapier-sdk run-action cosmolex write newTimecard`

## AI by Zapier

### Identity
Smart task and text handling powered by a flexible AI. Create text prompts to perform standard tasks like extracting lead (or other) data or answer discrete questions like "where should this message be routed?". Or, create your own!

- App slug: ai
- Operations published here: 4 (4 functions)

### Capabilities

#### Functions (4)

Functions change something in AI by Zapier.

##### Extract Content From URL
Extracts text content from various sources like web pages, PDFs, images, audio, or video files at a specified URL.

- Type: write · Key: `extract_content`
- Requires: url
- SDK: `runAction({ app: "ai", actionType: "write", action: "extract_content" })`
- CLI: `npx zapier-sdk run-action ai write extract_content`

##### Analyze and Return Data
Summarize, classify, extract, or generate data; optionally use tools and knowledge sources.

- Type: write · Key: `get_completion`
- Requires: authentication_id, model_id, instructions
- Optional: provider_id, inputFields, knowledgeSources, tools, outputSchema, outputFields, isOutputArray, previewWorkflowData, includeWorkflowData, stepApprovalThreshold, zap_id, zap_step_id, zap_run_id, zap_path_run_id, zap_attempt_id, held_execution_key
- SDK: `runAction({ app: "ai", actionType: "write", action: "get_completion" })`
- CLI: `npx zapier-sdk run-action ai write get_completion`

##### Analyze and Return Data (Agentic – Tools & Knowledge)
This action does nothing and must not be added to a Zap. It exists only so account admins can restrict agentic AI usage — Tools, Knowledge Sources, and web browsing — in the "Analyze and Return Data" action. Running it directly will error.

- Type: write · Key: `get_completion_agentic`
- Requires: nothing
- Optional: notice
- SDK: `runAction({ app: "ai", actionType: "write", action: "get_completion_agentic" })`
- CLI: `npx zapier-sdk run-action ai write get_completion_agentic`

##### Search Content Across URLs
Searches for information across the text content derived from multiple URLs (e.g., web pages, PDFs, images).

- Type: write · Key: `search_content`
- Requires: urls, query
- Optional: num_results
- SDK: `runAction({ app: "ai", actionType: "write", action: "search_content" })`
- CLI: `npx zapier-sdk run-action ai write search_content`

## Frequently asked questions about automating with CosmoLex and AI by Zapier

### My AI agent already connects to my apps. Why add Zapier?

Your AI agent’s built-in or native connectors cover a limited set of popular apps. Zapier reaches 10,000+ apps and 90,000+ triggers and actions. Zapier also adds what your AI agent can’t: one place to manage logins and credentials, so you never paste an API key; automations that keep running after the chat closes, with fixes you can review when a run hits a snag; and the freedom to switch agent interfaces without starting over.

### Can’t my AI agent already run tasks on a schedule?

Most popular AI agents can run scheduled tasks. And for simple recurring jobs, that might be all you need. Automations that run on Zapier can run on a schedule too, but they can also start the moment something happens in your apps—like when a new lead/ticket comes in or you get an email reply. Zapier also uses AI only in the steps that need judgment, so routine steps like posting to Slack or updating Salesforce don’t burn model tokens.

### Why not have my AI agent write me a script?

You can, and the first version will probably work. The trouble comes later: a script needs somewhere to run, a way to hear about events, and someone to keep it going. If an API changes or a login expires, your script can quietly stop until you notice. It also holds your keys, often in a repo, where a leak can expose your accounts. With Zapier, your agent builds the automation, and you publish it. Zapier hosts it, handles your logins and credentials, and records every run. If a run fails, Zapier diagnoses what went wrong and prepares a fix you can review. Or you can decide which fixes Zapier can apply for you.

## Links
- CosmoLex integrations: zapier.com/apps/cosmolex/integrations.md
- AI by Zapier integrations: zapier.com/apps/ai/integrations.md
- Full page: zapier.com/apps/cosmolex/integrations/ai
- SDK: npmjs.com/package/@zapier/zapier-sdk