Create Users

The Create Users API allows you to create a user within Zenput.

Below is a sample call and a full description of input format, input parameters, and success and error output formats.

POST: /api/v3/users/

$ curl -X POST \
  https://www.zenput.com/api/v3/users/ \
    -H 'content-type: application/json' \
  -H 'X-API-TOKEN: your-api-token-goes-here' \
  -d '{
    "email": "[email protected]",
    "first_name": "first name",
    "last_name": "last name",
    "user_role": {
        "id": 1
    },
    "default_team": {
        "id": 1
    },
    "groups": [
        {
        "id": 1
    }
    ],
    "teams": [
        {
        "id": 1
    }
    ],
    "owned_locations": [
        {
        "id": 1
    }
    ]
}'

Input format:

{
  "password": password,
  "first_name": first_name,
  "last_name": last_name,
  "email": email,
  "sms_number": sms_number,
  "user_role": {
    "id": user_role_id,
  },
  "locale": locale,
  "default_team": {
    "id": default_team_id,
  },
  "groups": [
    {
      "id": group_id
    }
  ],
  "date_invited": date_invited,
  "date_redeemed": date_redeemed,
  "time_zone": time_zone,
  "teams": [
    {
      "id": team_id
    }
  ],
  "owned_locations": [
    {
      "id": owned_location_id
    }
  ]
}

Input parameters

Name

Required

Type

Description

password

No

Text

User password. At least 8 characters. Very weak password are rejected, such as '12345678', or 'password'

first_name

No

Text

User first name

last_name

No

Text

User last name

email

Required (if no sms_number is provided)

Text

User valid email, must be unique.

sms_number

Required (if no email is provided)

Text

User phone number

user_role_id

No

Text

Id from an existing User Role to set as the role of the new user

locale

No

Locale ID

Id for the Locale to set for this user, must be one of the following: en_US, es_ES, es_CO, fr_FR, de_DE, nl_NL, no_NO, pt_PT, pt_BR, id_ID, da_DK, pl_PL.

Defaults to: en_US

default_team_id

No

Integer

Id of existing team to set as the default team for the user.

group_id

No

Integer

Id for the permission group that this user belongs to, must be one of the following, 1: Owner, 2: Manager, 3: Submitter, 4: admin.
If none provided, then the user will have the default permission for the user role.

date_invited

No

Timestamp

Date for when the user was invited, must be in the following format: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]

E.g.
"2004-05-31T21:00:00"

date_redeemed

No

Timestamp

Date for when the invitation was redeemed must be in the following format: YYYY-MM-DDThh:mm[:ss[.uuuuuu]][+HH:MM|-HH:MM|Z]

E.g.
"2004-05-31T21:00:00"

time_zone

No

Timezone

Time zone for the user. Value must be one of TZ column of https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List

Defaults to Etc/UTC

team_id

No

Integer

Id from an existing team that the user will be member of.

owned_location_id

No

Integer

Id from an existing location that the user owns.

🚧

IDs must be from an existing resource

*_id parameters must be from already existing resources.

Output format, success

{
  "meta": {
    "status_code": 201
  },
  "data": {
    "id": 1,
    "username": "[email protected]",
    "first_name": "First name",
    "last_name": "Last name",
    "email": "[email protected]",
    "sms_number": null,
    "user_role": {
      "id": 1,
      "name": "User role"
    },
    "company": {
      "id": 1,
      "name": "Zenput",
      "features": []
    },
    "locale": "es_CO",
    "default_team": {
      "id": 1,
      "name": "Team name"
    },
    "groups": [
      {
        "id": 3,
        "name": "Submitter"
      }
    ],
    "date_invited": "2020-05-31T21:21:00+00:00",
    "date_redeemed": "2020-06-17T21:21:00+00:00",
    "display_name": "First name Last name",
    "time_zone": "Etc/UTC",
    "teams": [
      {
        "id": 1,
        "name": "Team name"
      },
    ],
    "owned_locations": [
      {
        "id": 1,
        "name": "Location name",
        "address": "5394 Banding Parkway",
        "city": "richmond",
        "state": "VA",
        "zipcode": "23289",
        "is_active": true,
        "user_count": null
      }
    ]
  }
}

Output format, failure

{
  "meta": {
    "status_code": 400
  },
  "errors": [
    {
      "field": "email",
      "message": "Enter a valid email address.",
      "code": "invalid"
    }
  ]
}