> For the complete documentation index, see [llms.txt](https://docs.rubica.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rubica.au/households/secure-presentations/agents-and-api.md).

# Sharing from an Agent or Integration

For admins and integrators: how a Rubica agent or another system shares a presentation with the same email and sign-in check as the card.

A Rubica agent that builds a presentation can share it straight to the client. Clients get exactly what they'd get if an adviser shared it from the card: your firm's email (or the standard one) and your firm's sign-in check.

It happens in two steps:

1. The agent publishes the page, restricted to the people it's for.
2. It asks your CRM to **invite** them. The CRM sets the sign-in check, looks up each person's date of birth if needed, and sends the emails from your firm.

The one-time sign-in links never pass through the agent.

## Settings

`GET /services/apexrest/rubica/content-share/settings`

Returns your firm's set-up, so an agent knows what will happen:

```json
{ "useTemplate": true, "sendFrom": "info@example.com.au", "defaultCheck": "dob", "fixedCheck": false }
```

## Invite

`POST /services/apexrest/rubica/content-share/invite`

```json
{
  "uuid": "2742e080-682c-440d-8206-f7f04d30c3ea",
  "emails": ["alex.rivers@example.com"],
  "check": "dob",
  "message": "Here's the plan we talked through on Tuesday.",
  "householdId": "001xx000003DGb2AAG",
  "senderEmail": "sam@example.com.au"
}
```

| Field         |                                                                                             |
| ------------- | ------------------------------------------------------------------------------------------- |
| `uuid`        | **Required.** The published presentation.                                                   |
| `emails`      | Who to invite. Leave out to invite everyone on the share. Each must already be on it.       |
| `check`       | `email`, `email_sms`, `dob` or `custom`. Leave out for your firm's default.                 |
| `passcode`    | For `custom`: at least 6 characters. Tell the client yourself; it's never emailed.          |
| `message`     | Fills `{{message}}` in your template.                                                       |
| `householdId` | The household, if the share doesn't already record it.                                      |
| `senderEmail` | The staff member it's from. Must be an active user; otherwise it's from whoever is calling. |

The reply says how each person was emailed:

```json
{ "uuid": "2742e080-…", "check": "dob",
  "sent": [ { "email": "alex.rivers@example.com", "via": "firm" } ] }
```

`via` is `firm` (your mailbox), `rubica` (the standard email) or `failed`.

### Errors

| Status | `error`                | Meaning                                                                                                         |
| ------ | ---------------------- | --------------------------------------------------------------------------------------------------------------- |
| 422    | `missing_birthdates`   | Date of birth was asked for, but some people have none in the CRM. `people` lists them. **Nobody was emailed.** |
| 400    | `not_on_list`          | An email isn't on the share. Add them when publishing.                                                          |
| 400    | `fixed_check`          | Your firm uses one check for every share, and the call asked for another.                                       |
| 400    | `passcode_needed`      | `custom` needs a passcode.                                                                                      |
| 409    | `withdrawn` / `public` | The share is withdrawn, or open to anyone (there's nobody to invite).                                           |
| 502    | `content_error`        | The presentation service couldn't be reached. Try again.                                                        |

The calling user needs the **Rubica Content Sharing** permission set.
