

**サポート終了通知:** 2026 年 10 月 30 日に、 AWS は Amazon Pinpoint のサポートを終了します。2026 年 10 月 30 日を過ぎると、Amazon Pinpoint コンソールまたは Amazon Pinpoint のリソース (エンドポイント、セグメント、キャンペーン、ジャーニー、分析) にアクセスできなくなります。詳細については、「[Amazon Pinpoint のサポート終了](https://docs.aws.amazon.com/console/pinpoint/migration-guide)」を参照してください。**注:** SMS、音声、モバイルプッシュ、OTP、電話番号の検証に関連する APIs は、この変更の影響を受けず、 AWS エンドユーザーメッセージングでサポートされています。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Amazon Pinpoint からエンドポイントをプログラムで削除する
<a name="audience-define-remove"></a>

エンドポイントは、顧客の 1 人に連絡する単一のメソッドを表します。各エンドポイントは、顧客の E メールアドレス、モバイルデバイス識別子、電話番号、またはメッセージを送信できる他のタイプの宛先を参照できます。多くの管轄区域では、この種の情報は、個人情報と見なされます。宛先不明でエラーになる場合や、顧客がアカウントを削除した場合など、特定の送信先へのメッセージの送信が不要になった場合は、そのエンドポイントを削除することができます。

## 例
<a name="audience-define-remove-endpoints"></a>

エンドポイントの削除方法を次の例に示します。

------
#### [ AWS CLI ]

Amazon Pinpoint を使用するには、AWS CLI でコマンドを実行します。

**Example Delete Endpoint コマンド**  
エンドポイントを削除するには、[https://docs.aws.amazon.com/cli/latest/reference/pinpoint/delete-endpoint.html](https://docs.aws.amazon.com/cli/latest/reference/pinpoint/delete-endpoint.html) コマンドを使用します。  

```
$ aws pinpoint delete-endpoint \
> --application-id application-id \
> --endpoint-id endpoint-id
```
コードの説明は以下のとおりです。  
+ *application-id* は、エンドポイントを含む Amazon Pinpoint プロジェクトの ID です。
+ *endpoint-id* は、削除するエンドポイントの ID です。
このコマンドのレスポンスは、削除したエンドポイントの JSON 定義です。

------
#### [ AWS SDK for Java ]

AWS SDK for Java が提供するクライアントにより、Java アプリケーションで Amazon Pinpoint API を使用できます。

**Example コード**  
エンドポイントを削除するには、`AmazonPinpoint` クライアントの `deleteEndpoint` メソッドを使用します。メソッドの引数として `DeleteEndpointRequest` オブジェクトを指定します。  

```
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.pinpoint.PinpointClient;
import software.amazon.awssdk.services.pinpoint.model.DeleteEndpointRequest;
import software.amazon.awssdk.services.pinpoint.model.DeleteEndpointResponse;
import software.amazon.awssdk.services.pinpoint.model.PinpointException;
```

```
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.pinpoint.PinpointClient;
import software.amazon.awssdk.services.pinpoint.model.DeleteEndpointRequest;
import software.amazon.awssdk.services.pinpoint.model.DeleteEndpointResponse;
import software.amazon.awssdk.services.pinpoint.model.PinpointException;

/**
 * Before running this Java V2 code example, set up your development
 * environment, including your credentials.
 *
 * For more information, see the following documentation topic:
 *
 * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
 */
public class DeleteEndpoint {
    public static void main(String[] args) {
        final String usage = """

                Usage:   <appName> <endpointId >

                Where:
                  appId - The id of the application to delete.
                  endpointId - The id of the endpoint to delete.
                """;

        if (args.length != 2) {
            System.out.println(usage);
            System.exit(1);
        }

        String appId = args[0];
        String endpointId = args[1];
        System.out.println("Deleting an endpoint with id: " + endpointId);
        PinpointClient pinpoint = PinpointClient.builder()
                .region(Region.US_EAST_1)
                .build();

        deletePinEncpoint(pinpoint, appId, endpointId);
        pinpoint.close();
    }

    public static void deletePinEncpoint(PinpointClient pinpoint, String appId, String endpointId) {
        try {
            DeleteEndpointRequest appRequest = DeleteEndpointRequest.builder()
                    .applicationId(appId)
                    .endpointId(endpointId)
                    .build();

            DeleteEndpointResponse result = pinpoint.deleteEndpoint(appRequest);
            String id = result.endpointResponse().id();
            System.out.println("The deleted endpoint id  " + id);

        } catch (PinpointException e) {
            System.err.println(e.awsErrorDetails().errorMessage());
            System.exit(1);
        }
        System.out.println("Done");
    }
}
```

SDK の完全な例については、「[GitHub](https://github.com/)」の「[DeleteEndpoint.java](https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/pinpoint/src/main/java/com/example/pinpoint/DeleteEndpoint.java)」を参照してください。

------
#### [ HTTP ]

HTTP リクエストを直接 REST API に送信して Amazon Pinpoint を使用することができます。

**Example DELETE Endpoint リクエスト**  
エンドポイントを削除するには、[Endpoint](https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-endpoints-endpoint-id.html) リソースに対して `DELETE` リクエストを発行します。  

```
DELETE /v1/apps/application-id/endpoints/endpoint-id HTTP/1.1
Host: pinpoint.us-east-1.amazonaws.com
Content-Type: application/json
Accept: application/json
Cache-Control: no-cache
```
コードの説明は以下のとおりです。  
+ *application-id* は、エンドポイントを含む Amazon Pinpoint プロジェクトの ID です。
+ *endpoint-id* は、削除するエンドポイントの ID です。
このリクエストのレスポンスは、削除したエンドポイントの JSON 定義です。

------