Extract Entities API

Extract entities from a text. An entity is a word or a group of words that represent a concept. For example, the word "Canada" represents the concept of a country. The word "Jim Carrey" represents the concept of a person. The word "Tesla" represents the concept of a company. The API will return a list of entities found in the text. The entities are classified into different types such as person, location, organization, etc.

Supported entity types: PER, LOC, ORG. The API works on English text.

Type Code Example
Location LOC Ireland
Person PER Michael Jordan
Organization ORG Tesla

GET
https://api.apileague.com/extract-entities

Parameters

NameExampleDescription
text
s r q
Jim Carrey is an actor from CanadaThe English text from which entities should be extracted. Max 2,000 characters for Latin-script text. Because the text travels in the URL, texts in other scripts are limited to about 800 characters.
api-key
s r q
abcd1234Your API key.
Example Request and Response
GET
https://api.apileague.com/extract-entities?text=Jim+Carrey+is+an+actor+from+Canada
{
    "entities": [
        {
            "type": "PER",
            "value": "Jim Carrey",
            "start_position": 0,
            "end_position": 10,
            "image": "https://upload.wikimedia.org/wikipedia/commons/8/8b/Jim_Carrey_2008.jpg"
        },
        {
            "type": "LOC",
            "value": "Canada",
            "start_position": 28,
            "end_position": 34,
            "image": null
        }
    ]
}
 Copy Codecurl -X GET 'https://api.apileague.com/extract-entities?text=Jim+Carrey+is+an+actor+from+Canada' \ -H 'x-api-key: myapikey'

Headers

Response Headers:

  • Content-Type: application/json
  • X-API-Quota-Request: The number of tokens used by the request
  • X-API-Quota-Used: The number of tokens used in total today
  • X-API-Quota-Left: The number of tokens left today (depends on your plan)

Frequently Asked Questions

What types of entities can be extracted?

The API currently supports the extraction of Persons (PER), Locations (LOC), and Organizations (ORG).

Does it provide images for the entities?

Yes, if available, the API attempts to provide a relevant image URL for the extracted entities, particularly for famous people.

Can it handle multiple languages?

The API is primarily optimized for English text but may work with other languages depending on the context and entity names.

How is the Extract Entities API different from the Detect Sentiment API?

The Extract Entities API identifies specific people, places, and organizations in the text, while the Detect Sentiment API analyzes the overall emotional tone of the text.

Questions? Need Help? Ask Away

Quotas

Calling this endpoint costs
3 tokens