Download OpenAPI specification:Download
Repustate's API is a simple RESTful API. All responses are in JSON format. Pay special attention to which HTTP verb is required. Successful responses return an HTTP status code of 200. Incorrect or missing arguments will result in status code 400.
There are two API endpoints. For text analytics and search, https://api.repustate.com serves as the primary endpoint.
Repustate IQ API calls should be sent to https://iq.repustate.com.
Make sure you use the correct endpoint depending on the API call you're using.
There are no limits to the number of calls you can make per minute/hour/day etc. however all accounts are subject to monthly limits according to the plan you signed up for. In the event that you exceed your monthly quota, you will receive an HTTP 429 response on all subsequent API calls.
Most API calls can be used with multiple languages, not just in English. To specify another language, you have to provide the two letter code (ISO 639-1) for the language you're interested in. The languages currently supported are:
LANGUAGE | CODE |
---|---|
Arabic (العربية) | ar |
Chinese (中文) | zh |
Danish (Dansk) | da |
Dutch (Nederlands) | nl |
English | en |
Finnish (Suomalainen) | fi |
French (Français) | fr |
German (Deutsch) | de |
Hebrew (עִברִית) | he |
Indonesian | id |
Italian (Italiano) | it |
Japanese (日本語) | ja |
Korean (한국어) | ko |
Norwegian (Norsk) | no |
Polish (Polski) | pl |
Portuguese (Português) | pt |
Russian (русский) | ru |
Spanish (Español) | es |
Swedish (Svenska) | sv |
Turkish (Türk) | tr |
Thai (ไทย) | th |
Urdu (اردو) | ur |
Vietnamese (Tiếng Việt) | vi |
There is no explicit authentication mechanism. You simply include your API key in each API request.
Sometimes it's necessary to maintain multiple profiles of sentiment rules, especially if you are an agency or a social media analytics company. You don't want to mix up one set of rules/scores with another. To that end, Repustate supports a means to keep your custom rules and subsequent sentiment analysis separate by use of a custom HTTP header "X-Sub-Account". This way, you still only need one Repustate API key, but can create rules for multiple "sub accounts" that you create and maintain on your end. Here's an example use of this header using cURL:
curl --header "X-Sub-Account: sub-account-1"
--data "text=Score this using my custom rules"
https://api.repustate.com/v4/{apikey}/score.json
This creates a new project in Repustate IQ and makes it available for adding new data immediately
Numeric ID of newly created project
curl -H "x-api-key: $apikey" -d "name=My Project&aspect_model=hotel&username=user@example.com" https://iq.repustate.com/api/project/
{- "project_id": 2345
}
Return JSON serialized objects representing data items added to this project
OK
curl -H "x-api-key: $apikey" https://iq.repustate.com/api/data/{project_id}/?metadata_key=rating
{- "total": 1592,
- "data": [
- {
- "text": "I loved their coffee",
- "date_created": "2021-01-01",
- "source": "News",
- "sentiment": 0.975,
- "language": "en",
- "aspects": [
- {
- "label": "food",
- "sentiment": 0.9775,
- "chunk": "I loved their coffee",
- "topic": "coffee",
- "sentiment_text": "loved"
}
], - "entities": [
- {
- "title": "Coffee",
- "classifications": "Product.drink"
}, - {
- "title": "Love",
- "classifications": "Person.emotion"
}
]
}
]
}
Delete Data items from a project. Careful, this operation cannot be undone.
OK
{- "total": 1592
}
Add a new data item to an existing project. Data will be added to a queue and analyzed in order they are received. The immediate response value is the task ID for this request. If your project is setup to have a webhook, this task ID will be in the request body of the webhook.
Created
curl -H "x-api-key: $apikey" -d "text=my news story&lang=en&source=nytimes.com&url=nytimes.com/my-story" https://iq.repustate.com/api/data/{project_id}/
{- "task_id": "2519ade0-1d78-11ec-9621-0242ac130002"
}
Retrieve news, reviews or social media data from the specified data source
Request created
Fail (missing arguments)
{- "search": "string",
- "source": "string",
- "doCreateSchedule": true,
- "scheduleFrequency": 0,
- "schedulePeriod": "string",
- "scheduleDatetime": "string"
}
Extract the sentiment from a piece of text. Scores range from -1
(negative) to 1
(positive) with a score of 0
being "neutral". Emoticons, emoji, and internet short forms are given greater weight in the algorithm.
OK
error
text=This is a great day to go for a run
{- "score": 0.9229105562880748,
- "status": "OK"
}
If you plan on analyzing a large number of text documents then we suggest utilizing our bulk API. With this API call, you can POST up to 500 pieces of text a time
when using English
and 100 pieces of text at a time for other languages
and Repustate will return a JSON list with a score for each block of text.
OK
error
curl -d "text1=This is one block of text&text2=This is another block of text" \ https://api.repustate.com/v4/{apikey}/bulk-score.json
{- "status": "OK",
- "results": {
- "text1": 0.923,
- "text2": -0.371
}
}
Longer text can sometimes contain multiple topics or ideas. If you want the sentiment as it relates to a particular topic within a block of text, then this API call will scope the sentiment to one (or more) topics.
OK
error
curl -d "text=I love the cake, but hated the hats&topics=cake,hats" \ https://api.repustate.com/v4/{apikey}/topic.json
{- "status": "OK",
- "results": [
- {
- "topic": "cake",
- "freq": 1,
- "score": 0.1136
}, - {
- "topic": "hats",
- "freq": 1,
- "score": -0.39129
}
]
}
Often you might be interested in the individual portions of a document's sentiment, rather than the overall sentiment. Chunking is the process of breaking up a document into its more interesting parts and evaluating the sentiment on it. This API call chunks and returns the sentiment for each chunk.
OK
error
curl -d "text=The service was great, the food was terrible" \ https://api.repustate.com/v4/{apikey}/chunk.json
{- "status": "OK",
- "chunks": [
- {
- "chunk": "The service was great",
- "score": 1
}, - {
- "chunk": "the food was terrible",
- "score": -1
}
]
}
List the custom sentiment rules you have created in a given language. Make note of the rule_id that is returned in the response, you'll need it if you want to delete a rule at a later point.
OK
error
curl https://api.repustate.com/v4/{apikey}/sentiment-rules.json
{- "rules": [
- {
- "rule_id": "f48dd58369252ba986d64a03b93c4609fe10a9e0",
- "sentiment": "pos",
- "text": "niceeeeee"
}, - {
- "rule_id": "83e254bf0cdc61f56a85b7c5bc00b7af603e706f",
- "sentiment": "neg",
- "text": "that is so sick"
}
], - "status": "OK"
}
If you'd like to add a custom rule for sentiment to either override how Repustate treats some words or to create domain specific language, this API call will do that for you.
OK
error
curl -d "text=that is so sick&sentiment=pos" \ https://api.repustate.com/v4/{apikey}/sentiment-rules.json
{- "status": "OK",
- "rule_id": "afde1234ab"
}
curl https://api.repustate.com/v4/{apikey}/sentiment-rules.json -X DELETE -G -d "rule_id=abcde12323&lang=ar"
{- "status": "OK"
}
Entities are people, places, business, brands, and ideas that are notable. Repustate will identify any and all in your text and will return them categorized. The full list of possible themes for a block of text are below:
OK
curl -d "text=Lowry and Siakam combined for 60 points in the Raps 101-85 win over the Cavs on Sunday" \ https://api.repustate.com/v4/{apikey}/entities.json
{- "entities": [
- {
- "classifications": [
- "Org.pro_basketball_team"
], - "title": "Toronto Raptors",
- "positions": [
- {
- "end": 51,
- "start": 47
}
]
}, - {
- "classifications": [
- "Org.pro_basketball_team"
], - "title": "Cleveland Cavaliers",
- "positions": [
- {
- "end": 76,
- "start": 72
}
]
}, - {
- "classifications": [
- "Time.day"
], - "title": "Sunday",
- "positions": [
- {
- "end": 86,
- "start": 80
}
]
}, - {
- "classifications": [
- "Person.pro_athlete"
], - "title": "Pascal Siakam",
- "positions": [
- {
- "end": 16,
- "start": 10
}
]
}, - {
- "classifications": [
- "Person.pro_athlete"
], - "title": "Kyle Lowry",
- "positions": [
- {
- "end": 5,
- "start": 0
}
]
}
], - "status": "OK",
- "themes": [
- "sports"
]
}
Sometimes sentiment alone isn't enough - you want to know which aspects of a particular subject carry sentiment. For example, if you're a hotel, you might be interested in knowing people's opinions on your staff, as well as your amenities and the food offerings. This API call automatically categorizes text according to industry-specific categories. Below is a list of pre-built aspect models available for all customers to use:
Each matching category will be a top level key with each matching text chunk a member in a list, along with its sentiment score
error
curl -d "text=I loved the rooms but the coffee could have been better&model=hotel" \ https://api.repustate.com/v4/{apikey}/aspect.json
{- "accommodations": [
- {
- "chunk": "I loved the rooms",
- "score": 0.975,
- "sentiment_topic": "rooms",
- "sentiment_text": [
- "loved"
]
}
], - "food": [
- {
- "chunk": "but the coffee could have been better",
- "score": -0.9575054935196873,
- "sentiment_topic": "coffee",
- "sentiment_text": [
- "better"
]
}
], - "status": "OK"
}
List all classifications and their related default themes for the current version of the API
OK
curl https://api.repustate.com/v4/{apikey}/classifications.json
{- "Event.activity": [ ],
- "Event.airplane_crash": [
- "politics"
], - "Event.award": [ ],
- "Event.coup": [
- "military",
- "politics"
], - "Event.crime": [
- "law"
], - "Event.financial": [
- "finance"
], - "Event.genocide": [
- "military",
- "politics"
], - "Event.government_policy": [
- "politics"
], - "Event.massacre": [ ],
- "Event.military_operation": [
- "military"
], - "Event.social": [ ],
- "Event.sport": [
- "sports"
], - "Event.sports": [
- "sports"
], - "Event.terrorist_attack": [
- "military",
- "politics"
], - "Event.trade_show": [ ],
- "Event.trial": [
- "law"
], - "Event.war": [
- "military"
], - "Health.artery": [
- "health"
], - "Health.bone": [
- "health"
], - "Health.disease": [
- "health"
], - "Health.disorder": [
- "health"
], - "Health.enzyme": [
- "health",
- "science"
], - "Health.muscle": [
- "health"
], - "Health.organ": [
- "health"
], - "Health.pharmaceutical": [
- "health"
], - "Health.surgery": [
- "health"
], - "Health.symptom": [
- "health"
], - "Health.vitamin": [
- "health"
], - "Location.airport": [ ],
- "Location.borough": [ ],
- "Location.bridge": [ ],
- "Location.building": [ ],
- "Location.canyon": [ ],
- "Location.city": [ ],
- "Location.city_area": [ ],
- "Location.continent": [ ],
- "Location.convention_centre": [ ],
- "Location.country": [ ],
- "Location.county": [ ],
- "Location.desert": [ ],
- "Location.direction": [ ],
- "Location.government_residence": [
- "politics"
], - "Location.highway": [ ],
- "Location.lake": [ ],
- "Location.language": [ ],
- "Location.lighthouse": [ ],
- "Location.mountain": [ ],
- "Location.mountain_range": [ ],
- "Location.museum_or_gallery": [
- "arts"
], - "Location.neighborhood": [ ],
- "Location.ocean": [ ],
- "Location.park": [ ],
- "Location.power_station": [
- "energy"
], - "Location.prison": [
- "law"
], - "Location.public_space": [ ],
- "Location.region": [ ],
- "Location.religious_site": [
- "religion"
], - "Location.river": [ ],
- "Location.sea": [ ],
- "Location.stadium": [
- "sports"
], - "Location.state_or_province": [ ],
- "Location.statue": [ ],
- "Location.train_station": [
- "transportation"
], - "Location.transit_line": [
- "transportation"
], - "Location.university": [
- "education"
], - "Location.waterfall": [ ],
- "Number.financials": [
- "finance"
], - "Number.math_constant": [
- "science"
], - "Org.broadcaster": [ ],
- "Org.business": [
- "business",
- "finance"
], - "Org.central_bank": [
- "finance"
], - "Org.college_sports_team": [
- "sports"
], - "Org.government_agency": [
- "politics"
], - "Org.government_committee": [
- "politics"
], - "Org.government_legislature": [
- "politics"
], - "Org.hackers": [
- "technology"
], - "Org.hospital": [
- "health"
], - "Org.ideology": [
- "politics"
], - "Org.intelligence_agency": [
- "military"
], - "Org.junior_hockey_team": [
- "sports"
], - "Org.militants": [
- "military",
- "politics"
], - "Org.military": [
- "military"
], - "Org.minor_league_baseball_team": [
- "sports"
], - "Org.music_group": [
- "arts"
], - "Org.news_agency": [ ],
- "Org.newspaper": [ ],
- "Org.nonprofit": [ ],
- "Org.online_news": [ ],
- "Org.political_party": [
- "politics"
], - "Org.pro_baseball_team": [
- "sports"
], - "Org.pro_basketball_team": [
- "sports"
], - "Org.pro_football_team": [
- "sports"
], - "Org.pro_hockey_team": [
- "sports"
], - "Org.pro_rugby_team": [
- "sports"
], - "Org.pro_soccer_team": [
- "sports"
], - "Org.radio_station": [
- "music"
], - "Org.religion": [
- "religion"
], - "Org.sports_league": [
- "sports"
], - "Org.stock_exchange": [
- "finance"
], - "Org.stock_index": [
- "finance"
], - "Org.transit_authority": [ ],
- "Org.transit_system": [ ],
- "Person.academic": [ ],
- "Person.actor": [
- "entertainment",
- "arts"
], - "Person.artist": [
- "arts"
], - "Person.author": [
- "arts"
], - "Person.broadcaster": [ ],
- "Person.businessman": [
- "business"
], - "Person.comedian": [
- "entertainment"
], - "Person.computer_scientist": [
- "technology"
], - "Person.criminal": [
- "law"
], - "Person.director": [
- "entertainment",
- "arts"
], - "Person.economist": [
- "business"
], - "Person.fictional_character": [
- "arts"
], - "Person.first_lady": [
- "politics"
], - "Person.first_nations": [ ],
- "Person.government_employee": [
- "politics"
], - "Person.hacker": [
- "technology"
], - "Person.head_of_state_title": [
- "politics",
- "business"
], - "Person.journalist": [ ],
- "Person.judge": [
- "law"
], - "Person.lawyer": [
- "law"
], - "Person.military_personnel": [
- "military"
], - "Person.military_rank": [
- "military"
], - "Person.model": [ ],
- "Person.music_group": [
- "arts"
], - "Person.musician": [
- "arts"
], - "Person.nationality": [ ],
- "Person.philanthropist": [ ],
- "Person.philosopher": [
- "arts"
], - "Person.physician": [
- "health"
], - "Person.playwright": [
- "arts"
], - "Person.poet": [
- "arts"
], - "Person.politician": [
- "politics"
], - "Person.pro_athlete": [
- "sports"
], - "Person.radio_host": [
- "entertainment"
], - "Person.relationship": [ ],
- "Person.religious_figure": [
- "religion"
], - "Person.religious_follower": [
- "religion"
], - "Person.religious_founder": [
- "religion"
], - "Person.royalty": [
- "politics"
], - "Person.scientist": [
- "science"
], - "Person.software_engineer": [
- "technology"
], - "Person.sports_coach": [
- "sports"
], - "Person.sports_position": [
- "sports"
], - "Person.surgeon": [
- "health"
], - "Person.terrorist": [
- "military",
- "politics"
], - "Person.tv_presenter": [ ],
- "Person.us_president": [
- "politics"
], - "Person.whistleblower": [ ],
- "Person.world_leader": [
- "politics"
], - "Product.airplane": [ ],
- "Product.album": [
- "entertainment",
- "arts"
], - "Product.automobile": [
- "automotive"
], - "Product.beer": [
- "food"
], - "Product.book": [
- "arts"
], - "Product.cargo_ship": [
- "business"
], - "Product.coffee": [
- "food"
], - "Product.commodity": [
- "finance"
], - "Product.cryptocurrency": [
- "technology",
- "finance"
], - "Product.currency": [
- "finance"
], - "Product.digital_media_player": [
- "technology"
], - "Product.financial": [
- "finance"
], - "Product.food": [
- "food"
], - "Product.headphones": [
- "music"
], - "Product.laundry_detergent": [ ],
- "Product.magazine": [ ],
- "Product.military_ship": [
- "military"
], - "Product.mobile_phone": [
- "technology"
], - "Product.movie": [
- "entertainment",
- "arts"
], - "Product.music_genre": [
- "arts"
], - "Product.musical_instrument": [
- "arts"
], - "Product.pipeline_system": [
- "energy"
], - "Product.podcast": [ ],
- "Product.smartphone": [
- "technology"
], - "Product.soft_drink": [
- "food"
], - "Product.tablet": [
- "technology"
], - "Product.tea": [
- "food"
], - "Product.tv_episode": [
- "entertainment"
], - "Product.tv_show": [
- "entertainment"
], - "Product.video_game": [
- "technology"
], - "Product.video_game_console": [
- "technology"
], - "Product.weapon": [
- "military"
], - "Product.wine": [
- "food"
], - "Science.amphibian": [
- "science"
], - "Science.bird": [
- "science"
], - "Science.chemical_compound": [
- "science"
], - "Science.chemical_element": [
- "science"
], - "Science.fish": [
- "science"
], - "Science.galaxy": [
- "science"
], - "Science.insect": [
- "science"
], - "Science.mammal": [
- "science",
- "sports"
], - "Science.planet": [
- "science"
], - "Science.plant": [
- "science"
], - "Science.reptile": [
- "science"
], - "Science.star": [
- "science"
], - "Technology.algorithm": [
- "technology"
], - "Technology.component": [
- "technology"
], - "Technology.cpu_architecture": [
- "technology"
], - "Technology.cpu_extensions": [
- "technology"
], - "Technology.file_format": [
- "technology"
], - "Technology.infotainment": [
- "technology",
- "automotive"
], - "Technology.mobile_interface": [
- "technology"
], - "Technology.network": [
- "technology"
], - "Technology.operating_system": [
- "technology"
], - "Technology.programming_language": [
- "technology"
], - "Technology.social_network": [
- "technology"
], - "Technology.software": [
- "technology"
], - "Technology.software_development_process": [
- "technology"
], - "Technology.software_license": [
- "technology"
], - "Technology.streaming_service": [
- "music",
- "technology"
], - "Technology.typeface": [
- "technology"
], - "Time.day": [ ],
- "Time.holiday": [ ],
- "Time.month": [ ],
- "Time.season": [ ],
- "status": "OK"
}
Calculate the semantic similarity, between 0 and 1, of two pieces of text in any language. Subject matter, entities, sentiment and entity metadata all play a factor in computing the semantic similarity
OK
curl -d "text1=Lowry and Siakam combined for 60 points in the Raps 101-85 win over the Cavs on Sunday&text2=LeBron James is excited about playing with Anthony Davis this year." \ https://api.repustate.com/v4/{apikey}/similar.json
{- "score": 0,
- "status": "OK"
}
Repustate can automatically assign labels to the text you analyze. Labels are defined as a mix of boolean operators, keyword matching, and a proximity operator. The following operators are allowed:
Zero, one, or more label filters can be returned for a given piece of text.
OK
curl -d "text=hockey AND basketball&label=sports" \ https://api.repustate.com/v4/{apikey}/filter-rules.json
{- "status": "OK"
}
curl "https://api.repustate.com/v4/repustatedemopage/clean-html.json?url=http%3A%2F%2Fwww.example.com"
{- "image": "",
- "status": "OK",
- "text": " Example Domain This domain is established to be used for illustrative examples in documents. You may use this domain in examples without prior coordination or asking for permission.\n More information...\n",
- "title": "Example Domain",
}
curl -X "POST" "https://api.repustate.com/v4/{apikey}/clean-html.json" \ -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ --data-urlencode "html=<html><head><title>Example Domain</title><meta charset=\"utf-8\" /><meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /><style type=\"text/css\">body {background-color: #f0f0f2;margin: 0;padding: 0;font-family: \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;}div {width: 600px;margin: 5em auto;padding: 50px;background-color: #fff;border-radius: 1em;}a:link, a:visited {color: #38488f;text-decoration: none;}@media (max-width: 700px) {body {background-color: #fff;}div {width: auto;margin: 0 auto;border-radius: 0;padding: 1em;}}</style> </head><body><div><h1>Example Domain</h1><p>This domain is established to be used for illustrative examples in documents. You may use thisdomain in examples without prior coordination or asking for permission.</p><p><a href=\"http://www.iana.org/domains/example\">More information...</a></p></div></body></html>"
{- "image": "",
- "status": "OK",
- "text": " Example Domain This domain is established to be used for illustrative examples in documents. You may use thisdomain in examples without prior coordination or asking for permission.\nMore information...\n",
- "title": "Example Domain",
- "url": ""
}
Apply the filter rules you've created to the supplied text block. Zero, one or more labels may be returned. For each label returned, we also show a list of (start, end) pairs designating where in the text the label was matched against.
OK
curl -d "text=I love to play hockey" \ https://api.repustate.com/v4/{apikey}/filter.json
{- "status": "OK",
- "myFilterID": [
- [
- 1,
- 10
], - [
- 19,
- 26
]
]
}
Get access to Repustate's all purpose part-of-speech tagger in the language of your choice. This API call returns the entire text block tagged with the part of speech for each word. The list of possible tags and their meaning for ALL languages is below:
NN
: noun
ADJ
: adjective
VB
: verb
ADV
: adverb
CONJ
: conjunction
PREP
: preposition
ART
: article
PP
: pronoun
POSS
: possessive noun
PUNC
: punctuation
OK
curl -d "text=Let me see the part of speech tags for this sentence!" \ https://api.repustate.com/v4/{apikey}/pos.json
{- "status": "OK",
- "text": "Let me see the part of speech tags for this sentence!",
- "language": "en",
- "tags": [
- {
- "tag": "VB",
- "word": "let"
}, - {
- "tag": "PP",
- "word": "me"
}, - {
- "tag": "VB",
- "word": "see"
}, - {
- "tag": "ART",
- "word": "the"
}, - {
- "tag": "NN",
- "word": "part"
}, - {
- "tag": "PREP",
- "word": "of"
}, - {
- "tag": "NN",
- "word": "speech"
}, - {
- "tag": "NN",
- "word": "tag"
}, - {
- "tag": "PREP",
- "word": "for"
}, - {
- "tag": "ART",
- "word": "this"
}, - {
- "tag": "NN",
- "word": "sentence"
}, - {
- "tag": "PUNC",
- "word": "!"
}
]
}
Given a piece of text , this API call will determine the language of the text in question. The response will contain a two letter code (ISO 639-1) representing the language identified. If a language cannot be accurately detected, an empty string will be returned as the language code.
OK
curl -d "text=أنا أحب أن تأكل البيتزا مع أصدقائي" \ https://api.repustate.com/v4/{apikey}/detect-language.json
{- "status": "OK",
- "language": "ar"
}
Return the time stamp (in seconds since Jan 1, 1970) that a custom sentiment rule or filter rule was added.
OK
curl https://api.repustate.com/v4/{apikey}/last-updated-rule.json
{- "status": "OK",
- "sentiment": 1516912486821,
- "filter": 151691248623
}
Repustate's Deep Search API is a simple RESTful API. All responses are in JSON format. Pay special attention to which HTTP verb is required. Successful responses return an HTTP status code of 200. Incorrect or missing arguments will result in status code 400.
The API endpoint is located at https://api.repustate.com/v4
There are no limits to the number of calls you can make per minute/hour/day etc. however all accounts are subject to monthly limits according to the plan you signed up for. In the event that you exceed your monthly quota, you will receive an HTTP 429 response on all subsequent API calls.
We've got client libraries to help you out. Download a Repustate client to get started.
Search the specified Deep Search index for matching documents. Up to 100 documents are returned in one call, but search supports pagination via a cursor request argument.
OK
error
curl https://api.repustate.com/v4/{apikey}/search.json?q=Person.politician.gender:M&index=my-index
{- "matches": [
- {
- "id": 2,
- "title": "my document title",
- "text": "my new document with George Bush Sr. as the male politician",
- "lang": "en",
- "otherid": "my_optional_custom_id",
- "entities": {
- "classifications": [
- "Person.us_president",
- "Person.politician",
- "Person.military_personnel",
- "Person.businessman",
- "Person.government_employee"
], - "title": "George H. W. Bush",
- "positions": [
- {
- "end": 36,
- "start": 21
}
]
}
}
], - "next": 0,
- "prev": 0,
- "status": "OK",
- "total": 1
}
Add a new document to a Deep Search index. If the index doesn't exist, it will be created.
OK
curl -X PUT -d "index=my-index&title=my title&text=my new document with George Bush Sr. as the male politician&lang=en" \ https://api.repustate.com/v4/{apikey}/search.json
{- "entities": {
- "classifications": [
- "Person.us_president",
- "Person.politician",
- "Person.military_personnel",
- "Person.businessman",
- "Person.government_employee"
], - "title": "George H. W. Bush",
- "positions": [
- {
- "end": 36,
- "start": 21
}
]
}, - "lang": "en",
- "sentiment": "neu",
- "status": "OK",
- "themes": "politics"
}
Search the specified Deep Search index for documents that are semantically similar to the document submitted. Up to 100 documents are returned in one call, but search supports pagination via a cursor request argument.
OK
error
curl https://api.repustate.com/v4/{apikey}/search-similar.json?index=my-index&text=I like to eat pizza and pasta
{- "matches": [
- {
- "id": 2,
- "title": "my document title",
- "text": "my new document with George Bush Sr. as the male politician",
- "lang": "en",
- "otherid": "my_optional_custom_id",
- "entities": {
- "classifications": [
- "Person.us_president",
- "Person.politician",
- "Person.military_personnel",
- "Person.businessman",
- "Person.government_employee"
], - "title": "George H. W. Bush",
- "positions": [
- {
- "end": 36,
- "start": 21
}
]
}
}
], - "next": 0,
- "prev": 0,
- "status": "OK",
- "total": 1
}
List all possible classifications that Deep Search can return
OK
curl https://api.repustate.com/v4/{apikey}/search-classifications.json
{- "status": "OK",
- "classifications": [
- "Location.country",
- "Location.citytown",
- "Location.continent",
- "Location.region",
- "Location.tourist_attraction"
]
}
For a given Deep Search classification, show all possible metadata properties that be searched against.
OK
curl https://api.repustate.com/v4/{apikey}/search-metadata.json?classification=Location.country
{- "status": "OK",
- "metadata": [
- "Location.country.areaKm",
- "Location.country.population",
- "Location.country.GDP"
]
}
curl https://api.repustate.com/v4/{apikey}/custom-entities.json
{- "entities": [
- "Custom Entity 1",
- "Custom Entity 2"
], - "status": "OK"
}
You can add your own entities to be recognized by Deep Search. These entities will be localized to your account only and no one else can see or access them.
OK
curl -d "title=My Custom Entity&body=This is my custom entity&classifications[]=Person.politician" \ https://api.repustate.com/v4/{apikey}/custom-entities.json
{- "status": "OK"
}
List all of the aliases defined for a custom entity you previously added
OK
curl https://api.repustate.com/v4/{apikey}/custom-aliases.json?title=My+Custom+Entity&lang=en
{- "entities": [
- "Alias 1",
- "Alias 2",
- "Alias 3"
], - "status": "OK"
}
Add an alias to a previously added entity. This could be their Twitter handle, a translation in another language etc.
OK
curl -d "title=My Entity&alias=Alias 1&lang=en" https://api.repustate.com/v4/{apikey}/custom-aliases.json
{- "status": "OK"
}
curl https://api.repustate.com/v4/{apikey}/custom-aliases.json -X DELETE -d "alias=My Alias&title=My Entity"
{- "status": "OK"
}
Repustate provides a very simple way to embed a search bar anywhere on your website to allow you to let your customers (or internal users) the ability to search any of your Deep Search indexes.
At a bare minimum, you'll have to create an element (likely a div) to contain the Deep Search search bar widget as well as import the Deep Search Javascript file. Below is a minimal example of what's needed:
<html>
<head>
<script type="text/javascript" src="https://path/to/deepsearch.js.min"></script>
</head>
<body>
<div id="ds-container"></div>
</body>
</html>
Now let's create the widget itself. This code should be placed right before the closing body tag. Remember to put your API key and your Deep Search index in place of the variable names below.
const el = document.getElementById("ds-container");
const options = {
"pagesize":30
};
const searchbar = new DeepSearch(el, YOUR_API_KEY, YOUR_INDEX, options);
This will create a fully functional Deep Search widget on your website or in your web application. To read more about customizing the behaviour of your search widget and how to do more complex actions like pagination and rendering results, read the JS SDK docs.