API Documentation

To use the CelebrityNinjas API, you need to sign up for a free account and get an API key.

While there is currently no hard limit on API requests, applications sending large number of requests per day will be throttled. If you need larger API request volumes or want to inquire about commercial use cases, please contact us.

/v1/search

HTTP GET

Search celebrities by name. Returns a list of celebrities that match the search parameters.

Parameters

name (required) - a string containing the celebrity name you wish to search. Cannot exceed 50 characters.

limit (optional) - a positive integer limiting how many celebrities to show. Maximum possible value and default value is 20.

Headers

X-Api-Key (required) - API Key associated with your account.

Sample Request URL

Live Demo!

https://api.celebrityninjas.com/v1/search?limit=10&name=   
Sample Response
[
  {
    "name": "Michael Jackson",
    "gender": "male",
    "height": 1.75,
    "birthday": "1958-08-29",
    "net_worth": 500000000,
    "nationality": "us",
    "deathday": "2009-06-25",
    "occupation": [
      "entertainer",
      "singer-songwriter",
      "musician",
      "choreographer",
      "record_producer",
      "actor",
      "businessperson",
      "film_producer",
      "dancer",
      "film_score_composer"
    ]
  }
]
import requests

api_url = 'https://api.celebrityninjas.com/v1/search?name='
name = 'michael jackson'
response = requests.get(api_url + name, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
    print(response.text)
else:
    print("Error:", response.status_code, response.text)
var name = 'michael jackson'
$.ajax({
    method: 'GET',
    url: 'https://api.celebrityninjas.com/v1/search?name=' + name,
    headers: { 'X-Api-Key': 'YOUR_API_KEY'},
    contentType: 'application/json',
    success: function(result) {
        console.log(result);
    },
    error: function ajaxError(jqXHR) {
        console.error('Error: ', jqXHR.responseText);
    }
});
const request = require('request');
var name = 'michael jackson';
request.get({
  url: 'https://api.celebrityninjas.com/v1/search?name='+name,
  headers: {
    'X-Api-Key': 'YOUR_API_KEY'
  },
}, function(error, response, body) {
  if(error) return console.error('Request failed:', error);
  else if(response.statusCode != 200) return console.error('Error:', response.statusCode, body.toString('utf8'));
  else console.log(body)
});
String name = 'michael jackson';
Response response = Request.Get("https://api.celebrityninjas.com/v1/search?name="+name)
.addHeader("X-Api-Key", "YOUR_API_KEY")
.execute();
let name = "michael jackson".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
let url = URL(string: "https://api.celebrityninjas.com/v1/search?name="+name!)!
var request = URLRequest(url: url)
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "X-Api-Key")
let task = URLSession.shared.dataTask(with: request) {(data, response, error) in
    guard let data = data else { return }
    print(String(data: data, encoding: .utf8)!)
}
task.resume()
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
NSString *query = @"https://api.celebrityninjas.com/v1/search?name=michael jackson";
NSString* encodedQuery = [query stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
[request setHTTPMethod:@"GET"];
[request setURL:[NSURL URLWithString:encodedQuery]];
[request setValue:@"YOUR_API_KEY" forHTTPHeaderField:@"X-Api-Key"];
NSError *error = nil;
NSHTTPURLResponse *responseCode = nil;

NSData *oResponseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&responseCode error:&error];
NSLog([[NSString alloc] initWithData:oResponseData encoding:NSUTF8StringEncoding]);
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.