{"meta":{"title":"ソーシャル アカウントの REST API エンドポイント","intro":"REST API を使って、認証されたユーザーのソーシャル アカウントを管理します。","product":"REST API","breadcrumbs":[{"href":"/ja/enterprise-cloud@latest/rest","title":"REST API"},{"href":"/ja/enterprise-cloud@latest/rest/users","title":"ユーザー"},{"href":"/ja/enterprise-cloud@latest/rest/users/social-accounts","title":"ソーシャル アカウント"}],"documentType":"article"},"body":"# ソーシャル アカウントの REST API エンドポイント\n\nREST API を使って、認証されたユーザーのソーシャル アカウントを管理します。\n\n## ソーシャル アカウントの管理について\n\n要求 URL に `{username}` パラメーターが含まれていない場合、応答はサインインしているユーザーに対して行われます (要求で[認証情報](/ja/enterprise-cloud@latest/rest/authentication/authenticating-to-the-rest-api)を渡す必要があります)。 ユーザーが 2 要素認証を有効にしているかどうかなどの追加の個人情報は、基本認証またはの`user`スコープを使用した認証時に含まれます。\n\n> \\[!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## List social accounts for the authenticated user\n\n```\nGET /user/social_accounts\n```\n\nLists all of your social accounts.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/social_accounts\n```\n\n**Response schema (Status: 200):**\n\nArray of `Social account`:\n\n* `provider`: required, string\n* `url`: required, string\n\n## Add social accounts for the authenticated user\n\n```\nPOST /user/social_accounts\n```\n\nAdd one or more social accounts to the authenticated user's profile.\nOAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Body parameters\n\n* **`account_urls`** (array of strings) (required)\n  Full URLs for the social media profiles to add.\n\n### HTTP response status codes\n\n* **201** - Created\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Adding multiple social accounts\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/social_accounts \\\n  -d '{\n  \"account_urls\": [\n    \"https://facebook.com/GitHub\",\n    \"https://www.youtube.com/@GitHub\"\n  ]\n}'\n```\n\n**Response schema (Status: 201):**\n\nSame response schema as [List social accounts for the authenticated user](#list-social-accounts-for-the-authenticated-user).\n\n## Delete social accounts for the authenticated user\n\n```\nDELETE /user/social_accounts\n```\n\nDeletes one or more social accounts from the authenticated user's profile.\nOAuth app tokens and personal access tokens (classic) need the user scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Body parameters\n\n* **`account_urls`** (array of strings) (required)\n  Full URLs for the social media profiles to delete.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Deleting multiple social accounts\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/user/social_accounts \\\n  -d '{\n  \"account_urls\": [\n    \"https://facebook.com/GitHub\",\n    \"https://www.youtube.com/@GitHub\"\n  ]\n}'\n```\n\n**Response schema (Status: 204):**\n\n## List social accounts for a user\n\n```\nGET /users/{username}/social_accounts\n```\n\nLists social media accounts for a user. This endpoint is accessible by anyone.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/users/USERNAME/social_accounts\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List social accounts for the authenticated user](#list-social-accounts-for-the-authenticated-user)."}