# Copper

> Copper CRM - manage people, companies, leads, opportunities, projects, tasks and activities.

Lets an agent read and write your Copper CRM - people, companies, leads,
opportunities, projects, tasks, activities, and the reference data behind them.

## What it can do

| Method | What it does |
| --- | --- |
| `copper_get_account` | Get account details (confirms the credentials work). |
| `copper_list_users` | List team members; returns user ids for assignee_id. |
| `copper_get_user` | Get one user by id. |
| `copper_search_people` | List / search people (contacts) with filters. |
| `copper_get_person` | Get one person by id. |
| `copper_get_person_by_email` | Fetch a person by email address. |
| `copper_create_person` | Create a person. |
| `copper_update_person` | Update a person. |
| `copper_delete_person` | Delete a person. |
| `copper_search_companies` | List / search companies with filters. |
| `copper_get_company` | Get one company by id. |
| `copper_create_company` | Create a company. |
| `copper_update_company` | Update a company. |
| `copper_delete_company` | Delete a company. |
| `copper_search_leads` | List / search leads with filters. |
| `copper_get_lead` | Get one lead by id. |
| `copper_create_lead` | Create a lead. |
| `copper_update_lead` | Update a lead. |
| `copper_delete_lead` | Delete a lead. |
| `copper_convert_lead` | Convert a lead into a person (and optional company / opportunity). |
| `copper_search_opportunities` | List / search opportunities (deals) with filters. |
| `copper_get_opportunity` | Get one opportunity by id. |
| `copper_create_opportunity` | Create an opportunity. |
| `copper_update_opportunity` | Update an opportunity (advance stage, status, value). |
| `copper_delete_opportunity` | Delete an opportunity. |
| `copper_search_projects` | List / search projects with filters. |
| `copper_get_project` | Get one project by id. |
| `copper_create_project` | Create a project. |
| `copper_update_project` | Update a project. |
| `copper_delete_project` | Delete a project. |
| `copper_search_tasks` | List / search tasks with filters. |
| `copper_get_task` | Get one task by id. |
| `copper_create_task` | Create a task. |
| `copper_update_task` | Update a task (e.g. mark Completed). |
| `copper_delete_task` | Delete a task. |
| `copper_search_activities` | List / search logged activities. |
| `copper_get_activity` | Get one activity by id. |
| `copper_create_activity` | Log a User activity (note / call / email). |
| `copper_delete_activity` | Delete an activity. |
| `copper_list_activity_types` | List activity types (ids for logging / filtering). |
| `copper_list_pipelines` | List pipelines with their stages. |
| `copper_list_pipeline_stages` | List all pipeline stages across pipelines. |
| `copper_list_pipeline_stages_by_pipeline` | List stages of one pipeline. |
| `copper_list_customer_sources` | List customer (lead / opportunity) sources. |
| `copper_list_loss_reasons` | List opportunity loss reasons. |
| `copper_list_contact_types` | List person / company contact types. |
| `copper_list_custom_fields` | List custom field definitions. |
| `copper_get_custom_field` | Get one custom field definition. |
| `copper_create_custom_field` | Create a custom field definition. |
| `copper_update_custom_field` | Update a custom field definition. |
| `copper_list_related` | List records related to a record (optionally by type). |
| `copper_create_related` | Relate two records. |
| `copper_delete_related` | Remove a relationship. |
| `copper_list_webhooks` | List webhook subscriptions. |
| `copper_get_webhook` | Get one webhook subscription by id. |
| `copper_create_webhook` | Create a webhook subscription. |
| `copper_delete_webhook` | Delete a webhook subscription. |

## How to get credentials

Copper authenticates with an API key plus the email of the key owner. Both
are sent on every request (the `X-PW-AccessToken` and `X-PW-UserEmail`
headers).

1. Sign in to Copper as the user whose access the agent should use.
2. Open [Settings -> Integrations -> API Keys](https://app.copper.com/companies/_/app#/settings/api-keys).
3. Click **Generate API Key** and copy the key.
4. Note the **email address** of that same Copper user - it is required
   alongside the key.

The key inherits that user's permissions, and all actions are attributed to
that user in Copper's audit log.

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `COPPER_API_KEY` | Settings -> Integrations -> API Keys -> Generate API Key |
| `COPPER_USER_EMAIL` | The email of the Copper user who owns the API key |

## Links

- [Copper API Keys](https://app.copper.com/companies/_/app#/settings/api-keys)
- [API reference](https://developer.copper.com)
