---
title: "Link social identity to user"
method: POST
path: "/api/users/{userId}/identities"
tags: ["Users"]
---

# Link social identity to user

`POST /api/users/{userId}/identities`

Link authenticated user identity from a social platform to a Logto user.

The usage of this API is usually coupled with `POST /connectors/:connectorId/authorization-uri`. With the help of these pair of APIs, you can implement a user profile page with the link social account feature in your application.

Note: Currently due to technical limitations, this API does not support the following connectors that rely on Logto interaction session: `@logto/connector-apple`, `@logto/connector-saml`, `@logto/connector-oidc` and `@logto/connector-oauth`.

## Path parameters

- `userId` string, required

## Request body

- object
  - `connectorId` string, required — The Logto connector ID.
  - `connectorData` object, required — A json object constructed from the url query params returned by the social platform. Typically it contains `code`, `state` and `redirectUri` fields.

## Response `200`

A new identity is linked to the user.

- object

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Unprocessable Content

---

[API](https://skmtc.net/logto/apis/logto-api-references.md) · [All operations](https://skmtc.net/logto/apis/logto-api-references/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/logto/logto-api-references/versions/a163dc77d842/schema)
