Use rules to assign role based off custom field on user registration I have a headless Drupal and I'm trying to figure out how to auto assign a role during registration based off of a custom field (field_is_student) in the registration form.

I am trying to use Rules but I don't know how to access the field to check whether it's true or false. My rule is set to "After saving a new user (rules_entity_insert:user)" and the only options I get in the condition Data Selector are User based.

Here's what I'm using to create my users:

{
    "name": {
        "value": "username"
    },
    "mail": { 
        "value": "useremail@email.com"
    },
    "field_is_student":{
        "value": false
    }
}
The following Rule export does what you asked, for users created in the UI. In D8. I have tested it and it works. You will also need to use the (temporary) patch from https://www.drupal.org/project/rules/issues/2725525#comment-11438731 to work around the problem with in assigning roles.

The concept to understand is that Rules knows about the base fields for the entity type. But if you add fields, that's a new entity bundle, so you need to tell Rules that your data is of a certain bundle. To do that, you use the "Entity is of bundle" condition, as I show below. Then all the fields for that bundle will show up in the data selector.

langcode: en
status: true
dependencies: {  }
id: set_a_role_for_new_users
label: 'Set a role for new users.'
events:
  -
    event_name: 'rules_entity_insert:user'
description: 'Assign the ''student'' role to new users who identify themselves as students. Requires a boolean field ''field_is_student'' on the user object and requires an available role with machine id ''student''.'
tags: {  }
weight: 0
config_version: '3'
expression:
  id: rules_rule
  uuid: 36de9619-1401-4b21-a651-d3927c5b8dac
  weight: 0
  conditions:
    id: rules_and
    uuid: 416e90b0-d24c-4f37-8272-de0ecee5c375
    weight: 0
    conditions:
      -
        id: rules_condition
        uuid: bafe6fc4-f88f-4df2-af9b-2b3558257c2b
        weight: 0
        context_values:
          type: user
          bundle: user
        context_mapping:
          entity: user
        context_processors:
          type:
            rules_tokens: {  }
          bundle:
            rules_tokens: {  }
        provides_mapping: {  }
        condition_id: rules_entity_is_of_bundle
        negate: false
      -
        id: rules_condition
        uuid: 28787d22-54ca-49cf-af42-6f1011ed6494
        weight: 0
        context_values:
          operation: '=='
          value: '1'
        context_mapping:
          data: user.field_is_student.value
        context_processors:
          operation:
            rules_tokens: {  }
          value:
            rules_tokens: {  }
        provides_mapping: {  }
        condition_id: rules_data_comparison
        negate: false
  actions:
    id: rules_action_set
    uuid: 2933681a-a079-496d-bc79-f27ff53144eb
    weight: 0
    actions:
      -
        id: rules_action
        uuid: 38e8a3bb-0470-427f-80e1-53f6a703e8bf
        weight: 0
        context_values:
          roles:
            - student
        context_mapping:
          user: user
        context_processors:
          roles:
            rules_tokens: {  }
        provides_mapping: {  }
        action_id: rules_user_role_add