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

# Applying for a Legal Identity

> Submit a Legal Identity application via the Agent API

A Legal Identity is a cryptographically secured, Neuron-verified collection of personal or organizational information tied to an account. It is required for signing smart contracts, participating in token transactions, and using eDaler.

## Prerequisites

* An active, verified Neuron account with a valid JWT
* At least one cryptographic key created on the account (see [Creating cryptographic keys](/neuron-api/guides/creating-cryptographic-keys))

## Overview

```mermaid theme={null}
sequenceDiagram
  participant Client
  participant Neuron
  Client->>Neuron: Legal/GetApplicationAttributes
  Neuron-->>Client: Required fields, min photos, peer review rules
  Client->>Neuron: Legal/ValidatePNr (optional)
  Neuron-->>Client: Normalized personal number
  Client->>Neuron: Legal/ApplyId
  Neuron-->>Client: Legal Identity ID + Created status
  Client->>Neuron: Legal/AddIdAttachment (if required)
  Client->>Neuron: Legal/ReadyForApproval
  Neuron-->>Client: Application submitted for review
```

## Step 1: Get application requirements

Each Neuron can be configured with different minimum requirements for identity applications. Retrieve them before building your form:

```http theme={null}
POST /Agent/Legal/GetApplicationAttributes
Authorization: Bearer {token}
```

The response tells you:

* Which **properties** are required (e.g. first name, last name, personal number, country)
* Minimum number of **photos** required
* Whether **peer review** is available and how many approvals are needed
* Whether **ISO 3166** country codes are required

Use this to adapt your UI to the specific Neuron's rules.

## Step 2: Validate the personal number (optional)

If your application includes a personal number, validate and normalize it first:

```http theme={null}
POST /Agent/Legal/ValidatePNr
Authorization: Bearer {token}
Content-Type: application/json

{
  "pNr": "<personal number>",
  "country": "SE"
}
```

The response returns a normalized personal number. Using a normalized value avoids format mismatches during approval.

## Step 3: Submit the application

Submit the identity application, referencing the cryptographic key that will be associated with this identity:

```http theme={null}
POST /Agent/Legal/ApplyId
Authorization: Bearer {token}
Content-Type: application/json

{
  "keyId": "<your key local name>",
  "keyNamespace": "<your key namespace>",
  "keyPassword": "<key password>",
  "properties": [
    { "name": "FIRST", "value": "Jane" },
    { "name": "LAST",  "value": "Smith" },
    { "name": "PNR",   "value": "<normalized personal number>" },
    { "name": "COUNTRY", "value": "SE" }
  ]
}
```

Common property names for personal identities include `FIRST`, `MIDDLE`, `LAST`, `PNR`, `ADDR`, `ZIP`, `CITY`, `REGION`, `COUNTRY`. For organizational identities, additional properties like `ORGNAME`, `ORGNR`, `ORGDEPT`, and `ORGROLE` are available.

The response includes a **Legal Identity ID** and a status of `Created`.

<Note>
  The properties you include are cryptographically signed together with the key. They cannot be changed after submission — you must submit a new application if corrections are needed.
</Note>

## Step 4: Attach supporting documents (if required)

If the Neuron requires photos or other attachments:

```http theme={null}
POST /Agent/Legal/AddIdAttachment
Authorization: Bearer {token}
Content-Type: multipart/form-data

<binary file content with legalId and attachment fields>
```

Upload at least the minimum number of photos specified by `GetApplicationAttributes`.

## Step 5: Mark ready for approval

Once all attachments are uploaded, signal that the application is complete:

```http theme={null}
POST /Agent/Legal/ReadyForApproval
Authorization: Bearer {token}
Content-Type: application/json

{
  "legalId": "<legal identity ID>",
  "keyId": "<your key local name>",
  "keyNamespace": "<your key namespace>",
  "keyPassword": "<key password>"
}
```

This triggers the approval process on the Neuron.

## Monitoring the application status

Status changes are delivered asynchronously. Poll for updates using:

```http theme={null}
POST /Agent/Xmpp/PopMessages
Authorization: Bearer {token}
```

Or fetch the identity directly:

```http theme={null}
POST /Agent/Legal/GetIdentity
Authorization: Bearer {token}
Content-Type: application/json

{ "legalId": "<legal identity ID>" }
```

Monitor the `state` field. Proceed once it reaches `Approved`.

## Next steps

* [Getting your identity approved](/neuron-api/guides/getting-your-identity-approved) — understand the approval options and how to request peer review.
* [Contracts flow](/neuron-api/guides/contracts-flow) — use your approved identity to sign contracts.
