Skip to main content
POST
/
2
/
users
/
{id}
/
public_keys
Add public key
curl --request POST \
  --url https://api.x.com/2/users/{id}/public_keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "public_key": {
    "identity_public_key_signature": "<string>",
    "public_key": "<string>",
    "public_key_fingerprint": "<string>",
    "registration_method": "<string>",
    "signing_public_key": "<string>",
    "signing_public_key_signature": "<string>"
  },
  "version": "<string>",
  "generate_version": true
}
'
{
  "data": {
    "error_code": "<string>",
    "token_map": {
      "key_store_token_map_json": "<string>",
      "max_guess_count": 123,
      "realm_state_string": "<string>",
      "recover_threshold": 123,
      "register_threshold": 123,
      "token_map": [
        {
          "key": "<string>",
          "value": {
            "address": "<string>",
            "public_key": "<string>",
            "token": "<string>"
          }
        }
      ]
    },
    "version": "<string>"
  },
  "errors": [
    {
      "title": "<string>",
      "type": "<string>",
      "detail": "<string>",
      "status": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

id
string
required

The ID of the requesting user. Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

Example:

"2244994945"

Body

application/json
public_key
object
required

Public key registration payload.

version
string
required

Public key version.

generate_version
boolean

When true, the server generates a new version.

Response

The request has succeeded.

data
object
errors
object[]
Minimum array length: 1