Create an Identity

`POST` request to `/identities` to create an Identity.

POST to /identity

Creates an offchain Identity. Consider pairing this with createAtom for onchain Identity creation. The Intuition Portal user journey for creating a Identity combines both of these interactions.

POST https://api.intuition.systems/identity
   await fetch(`${apiUrl}/identity`, {
      method: 'POST',
      "headers": {
        "Content-Type": "application/json",
        "x-api-key": <API_KEY>
      },
      "body": {
         "display_name": "JP", // Required display name for Identity
         "creator": "0x...81", // Ethereum address for Identity creator
         "description": "It is JP.", // Optional description for identity
         "image": "https://my-image.com/me.jpg", // Optional image for Identity
         "external_reference": "https://github.com", // Optional link for Identity
      }
    })

Security

This request requires a valid API Key to be included with each request.

Headers

  • Content-Type: application/json

  • x-api-key: <API_Key>

Body Parameters

Response

If an Identity is successfully created you'll receive the Identity object for the new Identity.

{
  "id": "f9xxxxxx...",
  "identity_id": "did:intuition:ipfs:Xxx",
  "identity_hash": "x...",
  "display_name": "JP",
  "description": "It's me, JP",
  "image": "image_url",
  "creator": {
      "id": "7xxxxxxx...",
      "created_at": "2024-02-13T14:58:43.809055Z",
      "updated_at": "2024-02-13T14:58:43.809055Z",
      "last_login": "2024-02-21T18:47:26.556035Z",
      "api_key": "",
      "wallet": "0x...",
      "role": "User"
  },
  "status": "complete",
  "created_at": "2024-02-15T05:47:17.289011Z",
  "num_positions": 0,
  "updated_at": "2024-02-15T05:47:17.289011Z",
  "vault_id": "1",
  "assets_sum": "0",
  "conviction_sum": "0",
  "conviction_price": "0"
},

Here is an example Zod schema and TypeScript interface you can use for the Identity:

export const IdentitySchema = z.object({
  identity_id: z.string(),
  vault_id: z.string(),
  display_name: z.string(),
  description: z.string().optional(),
  image: z.string().optional(),
  corpora_id: z.string().nullish(),
  semantic: z.string().nullish(),
  external_reference: z.string().nullish(),
  creator: EmbedUserUserAggregatesSchema.optional(),
  created_at: z.string(),
  num_positions: z.number(),
  assets_sum: z.string(), // bigint
  conviction_sum: z.string(), // bigint
  conviction_price: z.string(), // bigint
  updated_at: z.string(),
  status: z.string().optional(),
  isUser: z.boolean().optional(),
  user_conviction: z.string().optional(), // bigint
  user_conviction_value: z.string().optional(), // bigint
}

Response Codes

Last updated