> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wfa.team/llms.txt
> Use this file to discover all available pages before exploring further.

# Invite a staff member

> Create a pending compliance team member with the Approver role.

`POST /create_pending_user`

<Note>
  This request sends invitation emails. Use a controlled test address.
</Note>

## Authorization

<ParamField header="Authorization" type="string" required>
  Company Bearer token. Keep it on your server.
</ParamField>

## Body parameters

<ParamField body="first_name" type="string" required>
  Staff member’s first name.
</ParamField>

<ParamField body="last_name" type="string" required>
  Staff member’s last name.
</ParamField>

<ParamField body="email" type="string" required>
  Staff member’s invitation email address.
</ParamField>

<ParamField body="staff_id" type="string" required>
  Your external Staff ID; use it when referring to the person in assessments.
</ParamField>

## Error responses

| Message | Meaning | Action |
| - | - | - |
| `Invalid authorization token` | Missing or unmatched company authorization. | Check the company token and Bearer header. |
| `Could not create pending user` | The account-creation step returned no user. | Check the staff details and whether the user already exists before retrying. |

## Response

<ResponseField name="response.user_id" type="string">
  Account identifier; separate from your external staff\_id.
</ResponseField>

<Note>
  Check the JSON response as well as HTTP status. HTTP 200 can contain an API error. If a request times out, check the assessment before retrying. Retry deduplication is not verified.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    'https://wfa-team-tool-v1.bubbleapps.io/version-test/api/1.1/wf/create_pending_user' \
    --header "Authorization: Bearer $WFA_COMPANY_TOKEN" \
    --header 'Content-Type: application/json' \
    --data '{
    "first_name": "Alex",
    "last_name": "Taylor",
    "email": "alex.taylor@example.com",
    "staff_id": "STAFF-001"
  }'
  ```

  ```javascript JavaScript theme={null}
  // Run on your server. Set WFA_COMPANY_TOKEN in its environment.
  const response = await fetch('https://wfa-team-tool-v1.bubbleapps.io/version-test/api/1.1/wf/create_pending_user', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.WFA_COMPANY_TOKEN}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "first_name": "Alex",
      "last_name": "Taylor",
      "email": "alex.taylor@example.com",
      "staff_id": "STAFF-001"
    })
  });
  const result = await response.json();
  // Check the JSON body as well as the HTTP status.
  console.log(result);
  ```

  ```python Python theme={null}
  # Run on your server. Set WFA_COMPANY_TOKEN in its environment.
  import os
  import requests

  response = requests.post(
      'https://wfa-team-tool-v1.bubbleapps.io/version-test/api/1.1/wf/create_pending_user',
      headers={
          'Authorization': f"Bearer {os.environ['WFA_COMPANY_TOKEN']}",
          'Content-Type': 'application/json',
      },
      json={
        "first_name": "Alex",
        "last_name": "Taylor",
        "email": "alex.taylor@example.com",
        "staff_id": "STAFF-001"
      },
      timeout=45,
  )
  # Check the JSON body as well as the HTTP status.
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "status": "success",
    "response": {
      "user_id": "YOUR_USER_ID"
    }
  }
  ```

  ```json Invalid token theme={null}
  {
    "status": "error",
    "success": false,
    "message": "Invalid authorization token"
  }
  ```

  ```json Creation failed theme={null}
  {
    "status": "error",
    "success": false,
    "message": "Could not create pending user"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.