## Create a sub-organization.

`print_mail.sub_organizations.create(SubOrganizationCreateParams**kwargs)  -> SubOrganizationCreateResponse`

**post** `/print-mail/v1/sub_organizations`

When creating a user through the API, the verifiedEmail field will automatically be
set to true. However, if public signups are used, the email will need to be verified
by the user.

### Parameters

- `country_code: str`

  The country code of the sub-organization.

- `email: str`

  The email of the user to be created alongside the sub-organization.

- `name: str`

  The name of the user to be created alongside the sub-organization.

- `organization_name: str`

  The name of the sub-organization.

- `password: str`

  The password of the user to be created alongside the sub-organization.

- `phone_number: Optional[str]`

  The phone number of the user to be created alongside the
  sub-organization.

### Returns

- `class SubOrganizationCreateResponse: …`

  - `sub_organization: SubOrganization`

    The Sub-Organization object.

    - `id: str`

      A unique ID prefixed with `sub_org_`.

    - `country_code: str`

      The country code of the sub-organization.

    - `created_at: datetime`

      The UTC time at which this resource was created.

    - `limit: int`

      The limit of mailings the sub-organization can send before being charged
      overages for the month.

    - `name: str`

      The name of the sub-organization.

    - `object: Literal["sub_org"]`

      Always `sub_org`.

      - `"sub_org"`

    - `spend: int`

      The current rolling charge for the sub-organization for the month, in
      cents.

    - `updated_at: datetime`

      The UTC time at which this resource was last update.

    - `usage: int`

      The amount of mail the sub-organization has sent out this month.

  - `user: User`

    The user object.

    - `id: str`

      A unique ID prefixed with `user_`.

    - `api_keys: List[UserAPIKey]`

      The user's API keys. Contains live and test mode API keys.

      - `value: str`

        The value of the API key.

      - `active_until: Optional[datetime]`

        An optional date which the API key is active until. After this date, the
        API key will no longer be valid.

    - `email: str`

      The email of the user.

    - `name: str`

      The name of the user.

    - `organization: str`

      A unique ID prefixed with `user_`.

    - `pending_invite: bool`

      Indicates if the user has a pending invite.

    - `roles: List[str]`

      The roles given to the user. Roles can be used to restrict access for
      users.

    - `verified_email: bool`

      Indicates if the user has a verified email or not.

    - `email_preferences: Optional[EmailPreferences]`

      A set of preferences for how a user should receive emails.

      - `order_preview_send_preference: Optional[Literal["do_not_send", "send_live_only", "send_live_and_test"]]`

        The list of preferences for receiving order preview emails.

        - `"do_not_send"`

        - `"send_live_only"`

        - `"send_live_and_test"`

    - `last_login_time: Optional[datetime]`

      The date and time at which the user last logged in.

    - `phone_number: Optional[str]`

      The phone number of the user.

    - `previous_emails: Optional[List[str]]`

      A list of emails the user has previously had. If a user has changed their
      email before, this list will be populated with all of the emails they
      once had.

### Example

```python
import os
from postgrid import PostGrid

client = PostGrid(
    print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"),  # This is the default and can be omitted
)
sub_organization = client.print_mail.sub_organizations.create(
    country_code="CA",
    email="suborg@postgrid.com",
    name="Calvin",
    organization_name="PostGrid",
    password="very-strong-password",
    phone_number="9059059059",
)
print(sub_organization.sub_organization)
```

#### Response

```json
{
  "user": {
    "id": "user_abc123def456ghi6789",
    "pendingInvite": false,
    "organization": "org_abc123def456ghi6789",
    "email": "user@postgrid.com",
    "name": "Calvin",
    "apiKeys": [
      {
        "value": "live_abcdefg"
      },
      {
        "value": "test_abcdefg"
      }
    ],
    "verifiedEmail": true,
    "roles": [
      "role_abc123def456ghi6789"
    ]
  },
  "subOrganization": {
    "usage": 0,
    "limit": 500,
    "spend": 0,
    "name": "PostGrid",
    "countryCode": "CA",
    "id": "sub_org_abc123def456ghi6789",
    "object": "sub_org",
    "createdAt": "2020-11-12T23:23:47.974Z",
    "updatedAt": "2020-11-12T23:23:47.974Z"
  }
}
```
