# Check iMessage

> Check whether a contact, phone number or Apple ID email is on iMessage.

Source: https://docs.mycrmsim.com/docs/contacts/check-imessage

```http
POST https://backend.mysmsgateway.app/api/v1/ext/contacts/check-imessage
```

- Category: myCRMSIM Contacts / Contacts
- Auth: Bearer access token
- Scope: `contacts.read`
- Limits: 10 checks / minute per Mac

Asks Apple, through the workspace's Mac, whether the handle is registered for iMessage — the same check as **Check iMessage** on a app.mycrmsim.com contact. Give a `contact_id` (its phone, else its email, is checked) or a `phone` (with country code) or an `email`. The answer is recorded, so the app.mycrmsim.com and later sends use it.

Needs a Mac with **Advanced Mode** on in the workspace (else 400 `NO_ADVANCED_MODE_MAC`). Apple rate-limits these lookups: each Mac takes **10 checks a minute** (429 `RATE_LIMITED` beyond that). A handle Apple has not seen recently can take 10–20 s to answer; after 26 s the request is a 504 `MAC_TIMEOUT` — try again.

`silenced` and `focus_status` say whether the recipient has notifications silenced by a Focus, when the Mac could tell (null otherwise) — see **Notify anyway**.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | body | number | yes | The workspace whose Mac does the check. Must belong to the installer. Example: `7` |
| `contact_id` | body | number | no | A contact in the workspace. Provide this, `phone` or `email`. Example: `1234` |
| `phone` | body | string | no | A phone number with country code. An Apple ID email is accepted here too. Example: `+61412345678` |
| `email` | body | string | no | An Apple ID email. Example: `john@icloud.com` |

## Request body

```json
{
  "workspace_id": 7,
  "contact_id": 1234
}
```

## Response fields (check)

| Field | Type | Description |
| --- | --- | --- |
| `handle` | string | The phone or email checked. |
| `available` | boolean | true when the handle is on iMessage. |
| `status` | string, nullable | Apple's raw answer, when the Mac reports one. |
| `silenced` | boolean, nullable | true when the recipient has notifications silenced by a Focus; null when unknown. |
| `focus_status` | string, nullable | The recipient's Focus state as Messages reports it; null when unknown. |
| `contact_id` | number, nullable | The contact checked, when `contact_id` was given. |

## Response 200

OK

```json
{
  "success": true,
  "data": {
    "handle": "+61412345678",
    "available": true,
    "status": "available",
    "silenced": false,
    "focus_status": null,
    "contact_id": 1234
  }
}
```

## Response 400

No contact_id, phone or email

```json
{
  "success": false,
  "message": "Provide contact_id, phone or email."
}
```

## Response 400

Phone without a country code

```json
{
  "success": false,
  "message": "phone must include the country code, e.g. +14155550123"
}
```

## Response 400

No Mac with Advanced Mode on the workspace

```json
{
  "success": false,
  "code": "NO_ADVANCED_MODE_MAC",
  "message": "No Mac with Advanced Mode is connected to this workspace. iMessage checks need a Mac with Advanced Mode on."
}
```

## Response 401

Missing or invalid token

```json
{
  "success": false,
  "message": "Invalid or expired access token."
}
```

## Response 403

Missing scope

```json
{
  "success": false,
  "message": "Missing scope(s): contacts.read. This integration was granted: …"
}
```

## Response 404

Workspace or contact not found

```json
{
  "success": false,
  "message": "Contact not found in this workspace"
}
```

## Response 429

More than 10 checks in a minute on this Mac

```json
{
  "success": false,
  "code": "RATE_LIMITED",
  "message": "Too many checks in the last minute. Try again shortly."
}
```

## Response 503

The Mac is not connected

```json
{
  "success": false,
  "code": "MAC_UNREACHABLE",
  "message": "The Mac isn't connected right now"
}
```

## Response 504

The Mac did not answer in time

```json
{
  "success": false,
  "code": "MAC_TIMEOUT",
  "message": "The Mac didn't answer in time. Try again."
}
```
