Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Getting information about a celebrity

Focus mode
Getting information about a celebrity - Amazon Rekognition

In these procedures, you get celebrity information by using the getCelebrityInfo API operation. The celebrity is identified by using the celebrity ID that's returned from a previous call to RecognizeCelebrities.

Calling GetCelebrityInfo

These procedures require the celebrity ID for a celebrity that Amazon Rekognition knows. Use the celebrity ID that you note in Recognizing celebrities in an image.

To get celebrity information (SDK)
  1. If you haven't already:

    1. Create or update a user with AmazonRekognitionFullAccess and AmazonS3ReadOnlyAccess permissions. For more information, see Step 1: Set up an AWS account and create a User.

    2. Install and configure the AWS CLI and AWS SDKs. For more information, see Step 2: Set up the AWS CLI and AWS SDKs.

  2. Use the following examples to call the GetCelebrityInfo operation.

    Java

    This example displays the name and information about a celebrity.

    Replace id with one of the celebrity IDs displayed in Recognizing celebrities in an image.

    //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.) package aws.example.rekognition.image; import com.amazonaws.services.rekognition.AmazonRekognition; import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder; import com.amazonaws.services.rekognition.model.GetCelebrityInfoRequest; import com.amazonaws.services.rekognition.model.GetCelebrityInfoResult; public class CelebrityInfo { public static void main(String[] args) { String id = "nnnnnnnn"; AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient(); GetCelebrityInfoRequest request = new GetCelebrityInfoRequest() .withId(id); System.out.println("Getting information for celebrity: " + id); GetCelebrityInfoResult result=rekognitionClient.getCelebrityInfo(request); //Display celebrity information System.out.println("celebrity name: " + result.getName()); System.out.println("Further information (if available):"); for (String url: result.getUrls()){ System.out.println(url); } } }
    Java V2

    This code is taken from the AWS Documentation SDK examples GitHub repository. See the full example here.

    import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.rekognition.RekognitionClient; import software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoRequest; import software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoResponse; import software.amazon.awssdk.services.rekognition.model.RekognitionException; /** * 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 CelebrityInfo { public static void main(String[] args) { final String usage = """ Usage: <id> Where: id - The id value of the celebrity. You can use the RecognizeCelebrities example to get the ID value.\s """; if (args.length != 1) { System.out.println(usage); System.exit(1); } String id = args[0]; Region region = Region.US_EAST_1; RekognitionClient rekClient = RekognitionClient.builder() .region(region) .build(); getCelebrityInfo(rekClient, id); rekClient.close(); } public static void getCelebrityInfo(RekognitionClient rekClient, String id) { try { GetCelebrityInfoRequest info = GetCelebrityInfoRequest.builder() .id(id) .build(); GetCelebrityInfoResponse response = rekClient.getCelebrityInfo(info); System.out.println("celebrity name: " + response.name()); System.out.println("Further information (if available):"); for (String url : response.urls()) { System.out.println(url); } } catch (RekognitionException e) { System.out.println(e.getMessage()); System.exit(1); } } }
    AWS CLI

    This AWS CLI command displays the JSON output for the get-celebrity-info CLI operation. Replace ID with one of the celebrity IDs displayed in Recognizing celebrities in an image. Replace the value of profile-name with the name of your developer profile.

    aws rekognition get-celebrity-info --id celebrity-id --profile profile-name
    Python

    This example displays the name and information about a celebrity.

    Replace id with one of the celebrity IDs displayed in Recognizing celebrities in an image. Replace the value of profile_name in the line that creates the Rekognition session with the name of your developer profile.

    # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.) import boto3 def get_celebrity_info(id): session = boto3.Session(profile_name='profile-name') client = session.client('rekognition') # Display celebrity info print('Getting celebrity info for celebrity: ' + id) response = client.get_celebrity_info(Id=id) print(response['Name']) print('Further information (if available):') for url in response['Urls']: print(url) def main(): id = "celebrity-id" celebrity_info = get_celebrity_info(id) if __name__ == "__main__": main()
    .NET

    This example displays the name and information about a celebrity.

    Replace id with one of the celebrity IDs displayed in Recognizing celebrities in an image.

    //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.) using System; using Amazon.Rekognition; using Amazon.Rekognition.Model; public class CelebrityInfo { public static void Example() { String id = "nnnnnnnn"; AmazonRekognitionClient rekognitionClient = new AmazonRekognitionClient(); GetCelebrityInfoRequest celebrityInfoRequest = new GetCelebrityInfoRequest() { Id = id }; Console.WriteLine("Getting information for celebrity: " + id); GetCelebrityInfoResponse celebrityInfoResponse = rekognitionClient.GetCelebrityInfo(celebrityInfoRequest); //Display celebrity information Console.WriteLine("celebrity name: " + celebrityInfoResponse.Name); Console.WriteLine("Further information (if available):"); foreach (String url in celebrityInfoResponse.Urls) Console.WriteLine(url); } }

    This example displays the name and information about a celebrity.

    Replace id with one of the celebrity IDs displayed in Recognizing celebrities in an image.

    //Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. //PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.) package aws.example.rekognition.image; import com.amazonaws.services.rekognition.AmazonRekognition; import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder; import com.amazonaws.services.rekognition.model.GetCelebrityInfoRequest; import com.amazonaws.services.rekognition.model.GetCelebrityInfoResult; public class CelebrityInfo { public static void main(String[] args) { String id = "nnnnnnnn"; AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient(); GetCelebrityInfoRequest request = new GetCelebrityInfoRequest() .withId(id); System.out.println("Getting information for celebrity: " + id); GetCelebrityInfoResult result=rekognitionClient.getCelebrityInfo(request); //Display celebrity information System.out.println("celebrity name: " + result.getName()); System.out.println("Further information (if available):"); for (String url: result.getUrls()){ System.out.println(url); } } }

GetCelebrityInfo operation request

The following is example JSON input and output for GetCelebrityInfo.

The input to GetCelebrityInfo is the ID for the required celebrity.

{ "Id": "nnnnnnn" }

GetCelebrityInfo operation response

GetCelebrityInfo returns an array (Urls) of links to information about the requested celebrity.

{ "Name": "Celebrity Name", "Urls": [ "www.imdb.com/name/nmnnnnnnn" ] }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.