NAV
shell

Introduction

Welcome to the Corporate News API!

Currently you can use our API to access Corporate News AI assisted search features and later on several other features and endpoints related to company news around the world.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "https://services.corporatenews.info/api/v1/endpoint/here" \
  -H "Authorization: Token xyzxyzxyz"

Make sure to replace xyzxyzxyz with your API key.

Corporate News uses API keys to allow access to the API. You can register a new Corporate News API key at web application site.

You will need paid account to access the API. Corporate News API expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Token xyzxyzxyz

AI Assisted Search

Get All Threads

curl "https://services.corporatenews.info/api/v1/threads/" \
  -H "Authorization: Token xyzxyzxyz"

It will list all threads and their log entries in one big list. Output is in JSON format like this:

[
  {
    "url": "http://services.corporatenews.info/api/v1/threads/10283/",
    "id": 10283,
    "log_name": "a35fe6f2-b255-479e-a1a1-74be4b8cbd4b",
    "user_prompt": "Hello",
    "state": "finished",
    "state_message": "agent finished",
    "user_prompt_created_at": "2024-03-09T12:49:02.767890Z",
    "alive": "2024-03-09T12:49:02.767912Z",
    "bot_type": "ai-assisted-search",
    "bot_response": "Hello! How can I assist you today? If you have any questions or need help with something, feel free to ask!",
    "bot_response_created_at": null,
    "bot_response_metadata": null
  },
  {
    "url": "http://services.corporatenews.info/api/v1/threads/10284/",
    "id": 10284,
    "log_name": "a35fe6f2-b255-479e-a1a1-74be4b8cbd4b",
    "user_prompt": "Latest news from technology",
    "state": "finished",
    "state_message": "agent finished",
    "user_prompt_created_at": "2024-03-09T12:50:10.611137Z",
    "alive": "2024-03-09T12:50:10.611145Z",
    "bot_type": "ai-assisted-search",
    "bot_response": "<long answer in markdown format>",
    "bot_response_created_at": null,
    "bot_response_metadata": null
  },
  ...
]

This endpoint retrieves all threads and their log entries in one big list.

HTTP Request

GET https://services.corporatenews.info/api/v1/threads/

Get a Specific Thread

curl "https://services.corporatenews.info/api/v1/threads/a35fe6f2-b255-479e-a1a1-74be4b8cbd4b/" \
  -H "Authorization: Token xyzxyzxyz"

The above command returns JSON structured like this:

[
  {
    "url": "http://services.corporatenews.info/api/v1/threads/10283/",
    "id": 10283,
    "log_name": "a35fe6f2-b255-479e-a1a1-74be4b8cbd4b",
    "user_prompt": "Hello",
    "state": "finished",
    "state_message": "agent finished",
    "user_prompt_created_at": "2024-03-09T12:49:02.767890Z",
    "alive": "2024-03-09T12:49:02.767912Z",
    "bot_type": "ai-assisted-search",
    "bot_response": "Hello! How can I assist you today? If you have any questions or need help with something, feel free to ask!",
    "bot_response_created_at": null,
    "bot_response_metadata": null
  },
  {
    "url": "http://services.corporatenews.info/api/v1/threads/10284/",
    "id": 10284,
    "log_name": "a35fe6f2-b255-479e-a1a1-74be4b8cbd4b",
    "user_prompt": "Latest news from technology",
    "state": "finished",
    "state_message": "agent finished",
    "user_prompt_created_at": "2024-03-09T12:50:10.611137Z",
    "alive": "2024-03-09T12:50:10.611145Z",
    "bot_type": "ai-assisted-search",
    "bot_response": "<long answer in markdown format>",
    "bot_response_created_at": null,
    "bot_response_metadata": null
  },
  ...
]

This endpoint retrieves all log entries for given log name.

HTTP Request

GET https://services.corporatenews.info/api/v1/threads/<LOG_NAME>/

URL Parameters

Parameter Description
LOG_NAME The LOG_NAME of the thread to retrieve. Log name is type of UUID e.g. a35fe6f2-b255-479e-a1a1-74be4b8cbd4b

Create a thread with prompt from the user

curl "https://services.corporatenews.info/api/v1/threads/0a128ef5-46d5-4e99-a487-1668420f5376/" \
  -X POST \
  -H "Authorization: Token xyzxyzxyz" \
  -H "Content-Type: application/json" \
  -d '{"user_prompt":"Hello", "wait_for_response":"True"}'

The above command returns JSON structured like this:

{
  "url": "http://services.corporatenews.info/api/v1/threads/10308/",
  "id": 10308,
  "log_name": "a35fe6f2-b255-479e-a1a1-74be4b8cbd4b",
  "user_prompt": "Hello",
  "state": null,
  "state_message": null,
  "user_prompt_created_at": "2024-03-09T13:21:34.750714Z",
  "alive": "2024-03-09T13:21:34.750724Z",
  "bot_type": "ai-assisted-search",
  "bot_response": "Hi there! How can I assist you today?",
  "bot_response_created_at": null,
  "bot_response_metadata": null
}

This endpoint creates a new thread with a starting question for the AI assisted search.

HTTP Request

POST https://services.corporatenews.info/api/v1/threads/<LOG_NAME:UUID>/

URL Parameters

Parameter Description
LOG_NAME:UUID Required format is UUID. This is to be used to identify a chat thread. This is good to store on client side for further use.

Body Parameters

Use JSON format in the body of the HTTP request. e.g. {"user_prompt":"Hello", "wait_for_response":"True"}

Parameter Description
user_prompt Search term, question etc for the AI assisted search
wait_for_response Use True to wait AI answer before returning the call. False is the default and will immeditialy return and you will need to query answer with seperate request.

Errors

Corporate News API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
404 Not Found -- The specified entry could not be found.
405 Method Not Allowed -- You tried to access a endpoint with an invalid method.
406 Not Acceptable -- You requested a format that isn't valid for the endpoint.
429 Too Many Requests -- You're requesting too much! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.