Skip to main content

SetupIdentity

Gets or creates an identity.

Passing an existing identity token in the body refreshes the token.

Temporary Accounts

Until the identity is linked with the Rivet Hub (see rivet.api.identity#PrepareGameLink), this identity will be temporary but still behave like all other identities.

This is intended to allow users to play the game without signing up while still having the benefits of having an account. When they are ready to save their account, they should be instructed to link their account (see rivet.api.identity#PrepareGameLink).

Storing Token

identity_token should be stored in some form of persistent storage. The token should be read from storage and passed to rivet.api.identity#SetupIdentity every time the client starts.

Request Body
  • existing_identity_token password

    Token returned from previous call to rivet.api.identity#SetupIdentity. If this token is invalid, a new identity will be returned.

Responses

SetupIdentity 200 response

Schema
  • identity_token password required

    Token used to authenticate the identity.

    Should be stored somewhere permanent.

    Pass this to rivet.api.identity#SetupIdentity$existing_identity_token next time rivet.api.identity#SetupIdentity is called.

    Token has a 90 day TTL. This means that if rivet.api.identity#SetupIdentity is not called again within 90 days, the token will no longer be valid. If this happens, the user can recover their account through the linking process (see rivet.api.identity#PrepareGameLink).

    This token should be stored locally and never sent to a server or another device.

    If this token is comprimised, anyone with access to this token has control of the identity.

  • identity_token_expire_ts date-time required

    Timestamp (in milliseconds) at which the token expires.

  • identity object required

    An identity profile.

    • identity_id string required

      Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

      A universally unique identifier.

    • display_name string required

      Possible values: 1 ≤ length ≤ 24, Value must match regular expression ^(?:[^ \n\r] ?)+[^ \n\r]$

      Represent a resource's readable display name.

    • account_number int32 required

      Possible values: value ≤ 9999

      Identity profile account number (#1234).

      These are assigned in addition to an identity's display name in order to allow multiple identities to have the same display name while still providing a unique handle.

      These are unique to each display name; you can have multiple accounts with different display names and the same account number.

    • avatar_url string required

      The URL of this identity's avatar image.

    • presence object

      Information about the identity's current status, party, and active game.

      • update_ts date-time required

        RFC3339 timestamp.

      • status string required

        Possible values: [online, away, offline]

        The current status of an identity. This helps players understand if another player is currently playing or has their game in the background.

      • game_activity object

        The game an identity is currently participating in.

        • game object required

          A game handle.

          • game_id string required

            Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

            A universally unique identifier.

          • name_id string required

            Possible values: 1 ≤ length ≤ 16, Value must match regular expression ^[a-zA-Z0-9](?:[a-zA-Z0-9]-?)+[a-zA-Z0-9]$

            A human readable short identifier used to references resources.

            Different than a rivet.common#Uuid because this is intended to be human readable.

            Different than rivet.common#DisplayName because this should not include special characters and be short.

          • display_name string required

            Possible values: 1 ≤ length ≤ 24, Value must match regular expression ^(?:[^ \n\r] ?)+[^ \n\r]$

            Represent a resource's readable display name.

          • logo_url string

            The URL of this game's logo image.

          • banner_url string

            The URL of this game's banner image.

        • message string required

          A short activity message about the current game activity.

        • public_metadata

          JSON data seen by anyone.

        • mutual_metadata

          JSON data seen only by the given identity and their mutual followers.

    • party object

      A party summary.

      • party_id string required

        Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

        A universally unique identifier.

      • create_ts date-time required

        RFC3339 timestamp.

      • activity required

        A union representing the activity of a given party.

      • external object required

        External links for a party.

        • chat string required

          A link to the given party's chat thread.

      • publicity object required
        • public string required

          Possible values: [none, view, join]

        • mutual_followers string required

          Possible values: [none, view, join]

        • groups string required

          Possible values: [none, view, join]

      • party_size int32 required

        Unsigned 32 bit integer.

      • members object[] required

        A list of party members.

        • identity object required

          An identity handle.

          • identity_id string required

            Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

            A universally unique identifier.

          • display_name string required

            Possible values: 1 ≤ length ≤ 24, Value must match regular expression ^(?:[^ \n\r] ?)+[^ \n\r]$

            Represent a resource's readable display name.

          • account_number int32 required

            Possible values: value ≤ 9999

            Identity profile account number (#1234).

            These are assigned in addition to an identity's display name in order to allow multiple identities to have the same display name while still providing a unique handle.

            These are unique to each display name; you can have multiple accounts with different display names and the same account number.

          • avatar_url string required

            The URL of this identity's avatar image.

          • presence object

            Information about the identity's current status, party, and active game.

            • update_ts date-time required

              RFC3339 timestamp.

            • status string required

              Possible values: [online, away, offline]

              The current status of an identity. This helps players understand if another player is currently playing or has their game in the background.

            • game_activity object

              The game an identity is currently participating in.

              • game object required

                A game handle.

                • game_id string required

                  Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

                  A universally unique identifier.

                • name_id string required

                  Possible values: 1 ≤ length ≤ 16, Value must match regular expression ^[a-zA-Z0-9](?:[a-zA-Z0-9]-?)+[a-zA-Z0-9]$

                  A human readable short identifier used to references resources.

                  Different than a rivet.common#Uuid because this is intended to be human readable.

                  Different than rivet.common#DisplayName because this should not include special characters and be short.

                • display_name string required

                  Possible values: 1 ≤ length ≤ 24, Value must match regular expression ^(?:[^ \n\r] ?)+[^ \n\r]$

                  Represent a resource's readable display name.

                • logo_url string

                  The URL of this game's logo image.

                • banner_url string

                  The URL of this game's banner image.

              • message string required

                A short activity message about the current game activity.

              • public_metadata

                JSON data seen by anyone.

              • mutual_metadata

                JSON data seen only by the given identity and their mutual followers.

          • party object

            A party handle.

            • party_id string required

              Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

              A universally unique identifier.

            • create_ts date-time required

              RFC3339 timestamp.

            • activity required

              A union representing the activity of a given party.

            • external object required

              External links for a party.

              • chat string required

                A link to the given party's chat thread.

          • is_registered boolean required

            Whether or not this identity is registered with a linked account.

          • external object required

            External links for an identity.

            • profile string required

              A link to this identity's profile page.

            • settings string

              A link to the Rivet settings page.

            • chat string

              A link to a chat page with the given identity.

        • is_leader boolean required

          Whether or not this party member is the leader of the given party.

        • join_ts date-time required

          RFC3339 timestamp.

        • state required

          A union representing the current state of a party member.

      • thread_id string required

        Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

        A universally unique identifier.

    • is_registered boolean required

      Whether or not this identity is registered with a linked account.

    • external object required

      External links for an identity.

      • profile string required

        A link to this identity's profile page.

      • settings string

        A link to the Rivet settings page.

      • chat string

        A link to a chat page with the given identity.

    • is_admin boolean required

      Whether or not this identity is an admin.

    • is_game_linked boolean

      Whether or not this game user has been linked through the Rivet dashboard.

    • dev_state string

      Possible values: [inactive, pending, accepted]

      The state of the given identity's developer status.

    • follower_count int32 required

      Unsigned 32 bit integer.

    • following_count int32 required

      Unsigned 32 bit integer.

    • following boolean required

      Whether or not the requestee's identity is following this identity.

    • is_following_me boolean required

      Whether or not this identity following the requestee's identity.

    • is_mutual_following boolean required

      Whether or not this identity is both followng and is followed by the requestee's identity.

    • join_ts date-time required

      RFC3339 timestamp.

    • bio string required

      Possible values: 1 ≤ length ≤ 200, Value must match regular expression ^[^\r]+$

      Detailed information about a profile.

    • linked_accounts undefined[] required

      A list of an identity's linked accounts.

    • groups object[] required

      A list of groups that the given identity is in.

      • group object required

        A group handle.

        • group_id string required

          Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

          A universally unique identifier.

        • display_name string required

          Possible values: 1 ≤ length ≤ 24, Value must match regular expression ^(?:[^ \n\r] ?)+[^ \n\r]$

          Represent a resource's readable display name.

        • avatar_url string

          The URL of this group's avatar image.

        • external object required

          External links for this group.

          • profile string required

            A link to this group's profile page.

          • chat string required

            A link to this group's chat page.

        • is_developer boolean

          Whether or not this group is a developer group.

    • games object[] required

      A list of game statistic summaries.

      • game object required

        A game handle.

        • game_id string required

          Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

          A universally unique identifier.

        • name_id string required

          Possible values: 1 ≤ length ≤ 16, Value must match regular expression ^[a-zA-Z0-9](?:[a-zA-Z0-9]-?)+[a-zA-Z0-9]$

          A human readable short identifier used to references resources.

          Different than a rivet.common#Uuid because this is intended to be human readable.

          Different than rivet.common#DisplayName because this should not include special characters and be short.

        • display_name string required

          Possible values: 1 ≤ length ≤ 24, Value must match regular expression ^(?:[^ \n\r] ?)+[^ \n\r]$

          Represent a resource's readable display name.

        • logo_url string

          The URL of this game's logo image.

        • banner_url string

          The URL of this game's banner image.

      • stats object[] required

        A list of game statistics.

        • config object required

          A game statistic config.

          • record_id string required

            Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

            A universally unique identifier.

          • icon_id string required

            Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

            A universally unique identifier.

          • format string required

            Possible values: [integer, float_1, float_2, float_3, duration_minute, duration_second, duration_hundredth_second]

            A value denoting the format method of a game statistic.

          • aggregation string required

            Possible values: [sum, average, min, max]

            A value denoting the aggregation method of a game statistic.

          • sorting string required

            Possible values: [desc, asc]

            A value denoting the sorting method of a game statistic.

          • priority int32 required

            Unsigned 32 bit integer.

          • display_name string required

            Possible values: 1 ≤ length ≤ 24, Value must match regular expression ^(?:[^ \n\r] ?)+[^ \n\r]$

            Represent a resource's readable display name.

          • postfix_singular string

            A string appended to the end of a singular game statistic's value. Example: 1 dollar.

          • postfix_plural string

            A string appended to the end of a game statistic's value that is not exactly 1. Example: 45 dollars.

          • prefix_singular string

            A string appended to the beginning of a singular game statistic's value. Example: value 1.

          • prefix_plural string

            A string prepended to the beginning of a game statistic's value that is not exactly 1. Example: values 45.

        • overall_value float required

          A single overall value of the given statistic.

  • game_id string required

    Possible values: Value must match regular expression ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$

    A universally unique identifier.