End of support notice: On October
30, 2026, AWS will end support for Amazon Pinpoint. After October 30, 2026, you will no
longer be able to access the Amazon Pinpoint console or Amazon Pinpoint resources (endpoints,
segments, campaigns, journeys, and analytics). For more information, see Amazon Pinpoint end of
support. Note: APIs related to SMS, voice,
mobile push, OTP, and phone number validate are not impacted by this change and are
supported by AWS End User Messaging.
Use CreateApp with an AWS SDK or CLI
The following code examples show how to use CreateApp.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- CLI
-
- AWS CLI
-
Example 1: To create an application
The following create-app example creates a new application (project).
aws pinpoint create-app \
--create-application-request Name=ExampleCorp
Output:
{
"ApplicationResponse": {
"Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example",
"Id": "810c7aab86d42fb2b56c8c966example",
"Name": "ExampleCorp",
"tags": {}
}
}
Example 2: To create an application that is tagged
The following create-app example creates a new application (project) and associates a tag (key and value) with the application.
aws pinpoint create-app \
--create-application-request Name=ExampleCorp,tags={"Stack"="Test"}
Output:
{
"ApplicationResponse": {
"Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example",
"Id": "810c7aab86d42fb2b56c8c966example",
"Name": "ExampleCorp",
"tags": {
"Stack": "Test"
}
}
}
- Java
-
- SDK for Java 2.x
-
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.pinpoint.PinpointClient;
import software.amazon.awssdk.services.pinpoint.model.CreateAppRequest;
import software.amazon.awssdk.services.pinpoint.model.CreateAppResponse;
import software.amazon.awssdk.services.pinpoint.model.CreateApplicationRequest;
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 CreateApp {
public static void main(String[] args) {
final String usage = """
Usage: <appName>
Where:
appName - The name of the application to create.
""";
if (args.length != 1) {
System.out.println(usage);
System.exit(1);
}
String appName = args[0];
System.out.println("Creating an application with name: " + appName);
PinpointClient pinpoint = PinpointClient.builder()
.region(Region.US_EAST_1)
.build();
String appID = createApplication(pinpoint, appName);
System.out.println("App ID is: " + appID);
pinpoint.close();
}
public static String createApplication(PinpointClient pinpoint, String appName) {
try {
CreateApplicationRequest appRequest = CreateApplicationRequest.builder()
.name(appName)
.build();
CreateAppRequest request = CreateAppRequest.builder()
.createApplicationRequest(appRequest)
.build();
CreateAppResponse result = pinpoint.createApp(request);
return result.applicationResponse().id();
} catch (PinpointException e) {
System.err.println(e.awsErrorDetails().errorMessage());
System.exit(1);
}
return "";
}
}
- Kotlin
-
- SDK for Kotlin
-
suspend fun createApplication(applicationName: String?): String? {
val createApplicationRequestOb =
CreateApplicationRequest {
name = applicationName
}
PinpointClient.fromEnvironment { region = "us-west-2" }.use { pinpoint ->
val result =
pinpoint.createApp(
CreateAppRequest {
createApplicationRequest = createApplicationRequestOb
},
)
return result.applicationResponse?.id
}
}
For a complete list of AWS SDK developer guides and code examples, see
Using Amazon Pinpoint with an AWS SDK.
This topic also includes information about getting started and details about previous SDK versions.