# invite\_members\_to\_org

`imerit_ango.sdk.SDK.`

## invite\_members\_to\_org(organization\_id, invite\_data)

Send invitations to new members to join your organization.

### Parameters

* **organization\_id:** string
  * The unique identifier for the organization. You can find the organization ID in [the user interface](/sdk/sdk-documentation.md#organization-ids).
* **invite\_data:** Invitation
  * An Invitation object containing the invitation details, with the following attributes:
  * **to:** List\[str]
    * List of email addresses of the invited members
  * **organization\_role:** OrganizationRoles
    * The role assigned to the invited members within the organization. Options include:
      * OrganizationRoles.Admin
      * OrganizationRoles.Member
  * **project\_assignments:** List\[ProjectAssignment], *Optional, default None*
    * **ProjectAssignment**
      * **project\_id:** string
        * The unique identifier for the project. You can find the project ID in [the user interface](/sdk/sdk-documentation.md#project-ids) or retrieve it using the [`list_projects`](/sdk/sdk-documentation/project-level-sdk-functions/list_projects.md) function.
      * **project\_role:** ProjectRoles
        * The role assigned to the invited members within the project. Options include:
          * <kbd>ProjectRoles.Manager</kbd>
          * <kbd>ProjectRoles.Labeler</kbd>
          * <kbd>ProjectRoles.Reviewer</kbd>
          * <kbd>ProjectRoles.Lead</kbd>

```python
from imerit_ango.models.invite import Invitation, ProjectAssignment
from imerit_ango.models.enums import OrganizationRoles, ProjectRoles
```

Returns:

* **output:** dict
  * A dictionary containing the result of the operation.
  * Including a `status` field indicating whether the request was successful and a `data` field containing the response payload with updated resources produced by the operation.

<details open>

<summary><strong>How to verify in Ango Hub?</strong></summary>

After successfully executing the `invite_members_to_org` function, you can validate the changes directly in Ango Hub.

Navigate to: **Organization → Members**

* Confirm that the invited members appear in the list under the invitations.
* Ensure that each user has been invited with the correct role assigned

{% hint style="info" %}
Changes made via the SDK are reflected in Ango Hub in near real-time. If updates are not immediately visible, please refresh the page.
{% endhint %}

</details>

### Example

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK
from imerit_ango.models.invite import Invitation, ProjectAssignment
from imerit_ango.models.enums import OrganizationRoles, ProjectRoles

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
organization_id = os.getenv('ORGANIZATION_ID')

ango_sdk = SDK(api_key)

project_assignment_1 = ProjectAssignment(project_id="PROJECT_ID_1", project_role=ProjectRoles.Labeler),
project_assignment_2 = ProjectAssignment(project_id="PROJECT_ID_2", project_role=ProjectRoles.Reviewer)

project_assignments = [project_assignment_1, project_assignment_2]

invitation = Invitation(
    to=["user_1@imerit.net", "user_2@imerit.net"],
    organization_role=OrganizationRoles.Member,
    project_assignments=project_assignments
)

response = ango_sdk.invite_members_to_org(
    organization_id=organization_id,
    invite_data=invitation
)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X POST "https://imeritapi.ango.ai/v2/organization/$ORGANIZATION_ID/invites" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY" \
  -d '{
    "organizationRole": "member",
    "projectAssignments": [
      {
        "projectId": "PROJECT_ID_1",
        "projectRole": "Labeler"
      },
      {
        "projectId": "PROJECT_ID_2",
        "projectRole": "Reviewer"
      }
    ],
    "to": [
      "user_1@imerit.net",
      "user_2@imerit.net"
    ]
  }'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**See also**

[update\_organization\_members\_role](/sdk/sdk-documentation/organization-level-sdk-functions/update_organization_members_role.md), [get\_organization\_invites](/sdk/sdk-documentation/organization-level-sdk-functions/get_organization_invites.md), [add\_members\_to\_project](/sdk/sdk-documentation/project-level-sdk-functions/add_members_to_project.md)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.imerit.net/sdk/sdk-documentation/organization-level-sdk-functions/invite_members_to_org.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
