> ## Documentation Index
> Fetch the complete documentation index at: https://auth0.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 認証済みユーザーのプロフィールを取得します。

> フィールドごとの読み取り・書き込み可否を示すアクセス ポリシーとともに、セルフサービスで管理可能な認証済みユーザーのプロフィール属性を取得します。

#### スコープ

スコープは、APIリクエストおよび認証トークンの権限とアクセスレベルを定義します。

[​](#scopes-scopes)


## OpenAPI

````yaml docs/ja-jp/oas/myaccount/myaccount-api-oas.json GET /profile
openapi: 3.1.0
info:
  title: My Account
  version: '1.0'
  description: >-
    Auth0 My Account API は、ユーザーが自分のアカウント情報を管理するための専用のエンドポイント群を提供します。これらの API
    を使用すると、お客様はアプリケーション内でセルフサービス体験を構築したり、ユーザーアカウントに詳細情報を段階的に追加したりできます。


    My Account API は、現在ログイン中のユーザーのコンテキストで動作し、ユーザー向けアプリケーション内で直接使用できます。


    :::tip Auth0 ドメインとカスタムドメインの使い分け


    My Account API では、正規の Auth0
    ドメインまたはカスタムドメインを使用できますが、次の項目を含むプロセス全体で、必ず同じものを使用する必要があります。


    - アクセストークンを取得する

    - audience の値を設定する

    - My Account API エンドポイントを呼び出す


    詳しくは、[Custom Domains](https://auth0.com/docs/customize/custom-domains)
    をご覧ください。


    :::


    ## My Account API を有効化する


    Auth0 Dashboard でテナントの My Account API を有効化できます。


    1. Authentication > APIs に移動します。

    2. MyAccount API のバナーを見つけます。

    3. Activate を選択します。


    ![](https://images.ctfassets.net/cdy7uua7fh8z/DGkDQNIHcegN8vtQyEvF3/a2e98b06867701a66fa1f1b3df1c996b/My_Account_API_-_Activate.png)


    デフォルトでは、My Account API は次の application API access policies で作成されます。


    `require_client_grant` はユーザーフロー用


    `deny_all` はクライアント（machine-to-machine）フロー用


    アプリケーションがユーザーに代わって My Account API
    にアクセスするには、そのアプリケーションに対してクライアントグラントを明示的に作成する必要があります。これにより、そのアプリケーションがリクエストできるスコープの上限を定義できます。あるいは、ユーザーアクセスポリシーのフローを
    allow_all に変更することもできます。これにより、テナント内の任意のアプリケーションが My Account API に対して任意の scope
    をリクエストできるようになります。


    My Account API は機密性の高い情報や操作を公開するため、Auth0 ではユーザーアクセスポリシーのフローに allow_all
    を使用することを推奨していません。My Account API
    では最小権限の原則に従い、アプリケーションが本当に必要なものにのみアクセスできるようにして、潜在的なセキュリティリスクを最小限に抑える必要があります。


    アプリケーションに最終的に付与される権限は、application API access policy でアプリケーションに許可される
    scopes、エンドユーザーに割り当てられたロールベースのアクセス制御 (RBAC)
    の権限、およびユーザーの同意（該当する場合）の共通部分によって決まります。


    :::info サポートされているフロー


    My Account API へのクライアントアクセス用の application API policy
    は更新できません。つまり、クライアント認証情報フローを使用して My Account API にアクセスすることはできません。


    :::


    application API access policies と、それに関連付けられた client grants
    の管理方法について詳しくは、[Application Access to APIs: Client
    Grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants)
    をご覧ください。


    ## アクセストークンを取得する


    My Account API 用のアクセストークンは、自分の API 用のアクセストークンを取得する場合と同じ方法で取得できます。


    :::info &nbsp

    My Account API に機密性の高い操作（認証方法の登録など）を許可する場合は、[多要素認証
    (MFA)](https://auth0.com/docs/secure/multi-factor-authentication)
    によって追加のセキュリティポリシーを適用するために、[step-up
    authentication](https://auth0.com/docs/secure/multi-factor-authentication/step-up-authentication)
    を使用することを強く推奨します。

    :::


    Universal Login を使用している場合は、次の記事を参照してください。


    - [Call Your API Using the Authorization Code
    Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/call-your-api-using-the-authorization-code-flow)

    - [Call Your API Using the Authorization Code Flow with
    PKCE](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce/call-your-api-using-the-authorization-code-flow-with-pkce)


    組み込みログインを使用している場合は、次の記事を参照してください。


    - [Call Your API Using Resource Owner Password
    Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow/call-your-api-using-resource-owner-password-flow)

    - [Login Flow with Native Passkeys
    API](https://auth0.com/docs/native-passkeys-api#login-flow)


    ## 例


    ### Universal Login での認可コードフロー


    **ステップ 1: 認可コードをリクエストする**


    ```

    curl --request GET \
      --url 'https://{yourDomain}/authorize?response_type=code&client_id={yourClientId}&redirect_uri=%7ByourRedirectUri%7D&scope=create%3Ame%3Aauthentication_methods&offline_access=&audience=https%3A%2F%2F{yourDomain}%2Fme%2F'
    ```


    **ステップ 2: code をアクセストークンと交換する**


    ```

    curl --request POST \
      --url 'https://{yourDomain}/oauth/token' \
      --header 'content-type: application/json' \
      --data '{"grant_type": "authorization_code","client_id": "{yourClientId}","client_secret": "{yourClientSecret}","code": "{yourAuthorizationCode}","redirect_uri": "{yourRedirectUri}","audience": "{yourAudience}","scope": "create:me:authentication_methods","offline_access": ""}'
    ```


    ### ネイティブ パスキーを使った埋め込み型ログイン


    **ステップ 1: ログインチャレンジをリクエストする**


    ```

    curl --request POST \
      --url 'https://{yourDomain}/passkey/challenge' \
      --header 'content-type: application/json' \
      --data '{"client_id": "{yourClientId}"}'
    ```


    **ステップ 2: 既存のユーザーを認証する**


    ```

    curl --request POST \
      --url 'https://{yourDomain}/oauth/token' \
      --header 'content-type: application/json' \
      --data '{  "grant_type": "urn:okta:params:oauth:grant-type:webauthn",  "client_id": "{yourClientId}",  "scope": "create:me:authentication_methods offline_access",  "audience": "https://{yourDomain}/me/",  "auth_session": "{sessionIdFromTheFirstRequest}",  "authn_response": "{authenticatorResponse}"}'
    ```
servers:
  - url: https://{host}/me/v1
    variables:
      host:
        default: auth0.auth0.com
        description: カスタムまたは標準のホスト名
security: []
tags:
  - name: factors
    description: 認証要素
    x-displayName: Factors
  - name: connected-accounts
    description: Connected Accounts
    x-displayName: Connected Accounts
  - name: authentication-methods
    description: 認証方法
    x-displayName: Authentication Methods
  - name: consents
    description: 同意
    x-displayName: Consents
  - name: organizations
    description: Organizations
    x-displayName: Organizations
  - name: profile
    description: プロフィール
    x-displayName: Profile
paths:
  /profile:
    get:
      tags:
        - profile
      summary: 認証済みユーザーのプロフィールを取得します。
      description: >-
        フィールドごとの読み取り・書き込み可否を示すアクセス
        ポリシーとともに、セルフサービスで管理可能な認証済みユーザーのプロフィール属性を取得します。
      operationId: getProfile
      parameters:
        - $ref: '#/components/parameters/HeaderCorrelationId'
        - $ref: '#/components/parameters/HeaderTraceparent'
        - $ref: '#/components/parameters/QueryFields'
        - $ref: '#/components/parameters/QueryIncludeFields'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetProfileResponseContent'
          description: プロフィールを正常に取得しました。
          headers:
            x-ratelimit-limit:
              $ref: '#/components/headers/XRateLimitLimitHeader'
            x-ratelimit-reset:
              $ref: '#/components/headers/XRateLimitResetHeader'
            x-ratelimit-remaining:
              $ref: '#/components/headers/XRateLimitRemainingHeader'
            x-correlation-id:
              $ref: '#/components/headers/CorrelationIdHeader'
            traceparent:
              $ref: '#/components/headers/TraceparentHeader'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '410':
          $ref: '#/components/responses/Gone'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - Bearer-DPoP:
            - read:me:profile
      x-codeSamples:
        - lang: typescript
          label: Get the authenticated user's profile.
          source: |
            import { MyAccountClient } from "@auth0/myaccount-js";

            async function main() {
                const client = new MyAccountClient({
                    domain: "{YOUR_DOMAIN}",
                    token: "<token>",
                });
                await client.profile.get({
                    fields: [
                        "given_name",
                    ],
                    include_fields: "true",
                });
            }
            main();
        - lang: javascript
          label: Get the authenticated user's profile.
          source: |
            import { MyAccountClient } from "@auth0/myaccount-js";

            async function main() {
                const client = new MyAccountClient({
                    domain: "{YOUR_DOMAIN}",
                    token: "<token>",
                });
                await client.profile.get({
                    fields: [
                        "given_name",
                    ],
                    include_fields: "true",
                });
            }
            main();
components:
  parameters:
    HeaderCorrelationId:
      in: header
      name: x-correlation-id
      required: false
      schema:
        type: string
      description: >-
        Auth0システム全体でリクエストを関連付けるために使用する、クライアントが指定する1回の操作の一意識別子です。この値はテナントログの`references.correlation_id`に表示され、レスポンスの`x-correlation-id`ヘッダーで返されます。無効または大きすぎる値は通知なく破棄され、生成されたUUID
        v4に置き換えられます。個人を特定できる情報（PII）は含めないでください。
    HeaderTraceparent:
      in: header
      name: traceparent
      required: false
      schema:
        type: string
      description: >-
        分散トレース全体でリクエストを関連付けるために使用する[W3C Trace
        Context](https://www.w3.org/TR/trace-context/)ヘッダーです。指定された場合は受信トレースが継続され、新しい子スパンがレスポンスの`traceparent`ヘッダーで返されます。トレースIDはテナントログの`references.trace_id`にも表示されます。形式が不正な値は無視されます。
    QueryFields:
      name: fields
      in: query
      required: false
      description: 含める、または除外するフィールド名のカンマ区切りの一覧（include_fieldsの値によって決まります）。
      style: form
      explode: false
      schema:
        $ref: '#/components/schemas/ProfileFields'
    QueryIncludeFields:
      name: include_fields
      in: query
      required: false
      description: >-
        true（デフォルト）の場合、fieldsで指定されたフィールドのみを返します。falseの場合、fieldsで指定されたフィールド以外のすべてのフィールドを返します。fieldsが指定されていない場合は無視されます。
      schema:
        $ref: '#/components/schemas/IncludeFieldsEnum'
  schemas:
    GetProfileResponseContent:
      description: フィールドごとの読み取り・書き込み可否を示すアクセス ポリシーを含む、セルフサービスで管理可能な認証済みユーザーのプロフィール属性。
      allOf:
        - $ref: '#/components/schemas/ProfileContent'
    ProfileFields:
      type: array
      items:
        $ref: '#/components/schemas/ProfileFieldEnum'
    IncludeFieldsEnum:
      type: string
      enum:
        - 'true'
        - 'false'
      default: 'true'
      description: >-
        true（デフォルト）の場合、fieldsで指定されたフィールドのみを返します。falseの場合、fieldsで指定されたフィールド以外のすべてのフィールドを返します。
    ProfileContent:
      type: object
      additionalProperties: false
      properties:
        given_name:
          type: string
          description: このユーザーの名（ファーストネーム／下の名前）。
        family_name:
          type: string
          description: このユーザーの姓（ラストネーム／名字）。
        name:
          type: string
          description: このユーザーの名前。
        nickname:
          type: string
          description: このユーザーが希望するニックネームまたは別名。
        picture:
          type: string
          description: このユーザーの画像、写真、またはアバターのURL。
        email:
          type: string
          format: email
          readOnly: true
          description: 読み取り専用。メールアドレスの管理には、/me/v1/identifiersを使用してください。
        phone_number:
          type: string
          readOnly: true
          description: 読み取り専用。電話番号の管理には、/me/v1/identifiersを使用してください。
        username:
          type: string
          readOnly: true
          description: 読み取り専用。ユーザー名の管理には、/me/v1/identifiersを使用してください。
        user_metadata:
          $ref: '#/components/schemas/UserMetadata'
          description: ユーザー定義のメタデータ。書き込み時に、最上位のキーが既存のメタデータにマージされます。
        created_at:
          type: string
          format: date-time
          readOnly: true
          description: このユーザーが作成された日時。
        updated_at:
          type: string
          format: date-time
          readOnly: true
          description: このユーザーが最後に更新または変更された日時。
        profile_policy:
          $ref: '#/components/schemas/ProfilePolicy'
          readOnly: true
    ErrorResponse:
      properties:
        type:
          type: string
        status:
          type: number
        title:
          type: string
        detail:
          type: string
        validation_errors:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      required:
        - type
        - status
        - title
        - detail
      type: object
      additionalProperties: false
    ProfileFieldEnum:
      type: string
      enum:
        - given_name
        - family_name
        - name
        - nickname
        - picture
        - email
        - phone_number
        - username
        - user_metadata
        - created_at
        - updated_at
        - profile_policy
    UserMetadata:
      type: object
      description: アプリケーションの中核機能には影響しない、ユーザー関連のデータ。セルフサービスで管理可能なキーのサブセットのみが返されます。
      additionalProperties: true
    ProfilePolicy:
      type: object
      description: 'RFC 6901 JSON Pointer（例: /email）をキーとするフィールドごとの書き込み可否。'
      additionalProperties:
        $ref: '#/components/schemas/ProfilePolicyEntry'
    ValidationError:
      type: object
      properties:
        detail:
          type: string
        field:
          type: string
        pointer:
          type: string
        source:
          type: string
      required:
        - detail
      additionalProperties: false
    ProfilePolicyEntry:
      type: object
      description: 単一のプロフィール フィールドの書き込み可否を示す記述子。
      required:
        - access
        - source
      additionalProperties: false
      properties:
        access:
          $ref: '#/components/schemas/ProfileFieldAccessEnum'
        source:
          $ref: '#/components/schemas/ProfileFieldSourceEnum'
        reason:
          type: string
          description: アクセスが read_only の場合にのみ存在します。フィールドに書き込めない理由を示します。
    ProfileFieldAccessEnum:
      type: string
      enum:
        - read_write
        - read_only
      description: 認証済みユーザーがこのフィールドに書き込めるかどうか。
    ProfileFieldSourceEnum:
      type: string
      enum:
        - user
        - idp
        - system
      description: このフィールドの値の信頼できる情報源。
  headers:
    XRateLimitLimitHeader:
      required: true
      description: 制限ウィンドウ内で許可されるリクエストの最大数
      schema:
        type: number
    XRateLimitResetHeader:
      required: true
      description: bucket が補充される予定時刻（UNIXタイムスタンプ、秒単位）
      schema:
        type: number
    XRateLimitRemainingHeader:
      required: true
      description: リクエストが拒否されるまで、現在のウィンドウ内で残っているリクエスト数
      schema:
        type: number
    CorrelationIdHeader:
      required: false
      description: リクエストで指定された検証済みの`x-correlation-id`、または指定されなかった場合は生成されたUUID v4を返します。
      schema:
        type: string
    TraceparentHeader:
      required: false
      description: >-
        新しい子スパンIDとともに受信トレースIDを返す[W3C Trace
        Context](https://www.w3.org/TR/trace-context/)ヘッダー。
      schema:
        type: string
    RetryAfterHeader:
      required: true
      description: クライアントが新しいリクエストを行う前に待機すべき秒数
      schema:
        type: number
    XAuth0ErrorKindHeader:
      description: レート制限の超過がグローバル（tenant 単位）制限であることを示す指標。
      schema:
        type: string
        const: global-rate-limit
  responses:
    BadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: スキーマに基づく入力が無効です。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: 認証されていません。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    Forbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: アクセスが禁止されています。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    Gone:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: 消えた。
      headers:
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
    TooManyRequests:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
      description: リクエストが多すぎます。
      headers:
        retry-after:
          $ref: '#/components/headers/RetryAfterHeader'
        x-ratelimit-limit:
          $ref: '#/components/headers/XRateLimitLimitHeader'
        x-ratelimit-reset:
          $ref: '#/components/headers/XRateLimitResetHeader'
        x-ratelimit-remaining:
          $ref: '#/components/headers/XRateLimitRemainingHeader'
        x-auth0-error-kind:
          $ref: '#/components/headers/XAuth0ErrorKindHeader'
        x-correlation-id:
          $ref: '#/components/headers/CorrelationIdHeader'
        traceparent:
          $ref: '#/components/headers/TraceparentHeader'
  securitySchemes:
    Bearer-DPoP:
      type: http
      scheme: bearer
      description: Bearer トークンと DPoP トークンは、API の設定に応じてサポートされます

````