---
title: "Create a team invitation"
method: POST
path: "/api/v3/teams/{team_id}/invitations"
tags: ["Team Invitations"]
---

# Create a team invitation

`POST /api/v3/teams/{team_id}/invitations`

## Request

- Base URL: `https://codemagic.io`
- URL: `https://codemagic.io/api/v3/teams/{team_id}/invitations`
- Auth: API key in header `x-auth-token`
- TypeScript: <https://skmtc.dev/codemagic/apis/codemagic-api/docs/api/v3/teams/:team_id/invitations/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `team_id` string, required

## Request body

- CreateInvitationSchema
  - `email` string, required
  - `roles` union[], required
    - union
      - InviteTeamRoleGrant
        - `role` 'admin' | 'member', required: A team role that can be granted to a member or an invitee. Ownership can't be granted.
        - `scope` 'team', required
      - InviteAppRoleGrant
        - `app_id` string, required
        - `role` 'app_developer' | 'app_viewer', required: An app role a member or an invitee can hold.
        - `scope` 'app', required

## Response `201`

Document created, URL follows

- InvitationSchemaNoPagination
  - `data` InvitationSchema, required
    - `id` string, required
    - `email` string, required
    - `roles` union[], required
      - union
        - InviteTeamRoleGrant
          - `role` 'admin' | 'member', required: A team role that can be granted to a member or an invitee. Ownership can't be granted.
          - `scope` 'team', required
        - InviteAppRoleGrant
          - `app_id` string, required
          - `role` 'app_developer' | 'app_viewer', required: An app role a member or an invitee can hold.
          - `scope` 'app', required
    - `status` 'pending' | 'accepted' | 'revoked', required
    - `created_at` string, date-time, required
    - `expires_at` string, date-time, required

## Other responses

- `400`: The request could not be validated
- `401`: Authentication is missing or invalid
- `403`: The caller lacks the required permission
- `404`: The requested resource does not exist
- `429`: The rate limit has been exceeded

---

[API](https://skmtc.dev/codemagic/apis/codemagic-api.md) - [All operations](https://skmtc.dev/codemagic/apis/codemagic-api/llms.txt) - [OpenAPI document](https://skmtc.dev/codemagic/apis/codemagic-api/revisions/be09630f65e2?raw)
