Introduction

You can interact with the C-MES API via HTTP requests from any programming language using any commonly used libraries. The API interface is free and available for all C-MES accounts. Payment is only made for the actual usage of services consumed, which is deducted from the prepaid amount according to the tariffs.

API link

https://api.c-mes.tech

API version

v1

Final link to the method

https://api.c-mes.tech/v1/{ method }

Authentication

API Keys

The C-MES API uses API keys for authentication. You can create API keys in your personal account after registering on the site. Each API key can be assigned to a project for subsequent request accounting and analysis. The number of API keys and Projects is unlimited.

Remember that your API key is secret! Do not share it with others or expose it in any client code (browsers, applications). Production requests should be routed through your own internal server, where your API key can be securely loaded from an environment variable or key management service.

All API requests must include your API key in the Authorization HTTP header as follows:

Authorization: Bearer $API_KEY

Example request

curl https://api.c-mes.tech/v1/info/balance \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \

Making requests

You can paste the command below into your terminal to execute your first API request. Make sure to replace $API_KEY with your secret API key.

curl https://api.c-mes.tech/v1/echo \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "Content": "info@c-mes.co.uk", "LanguageCode": "en", "Asynch": false }'

This request calls the echo method (/v1/echo). You should receive a response that looks similar to the following:

{ "RequestType": "POST", "ApiKey": "apikey-55*******************************91", "Content-Type": "application/json", "Method": "/v1/echo", "Content-Lenght": 88, "Status": "The request was successfully completed", "IP": "xxx.xxx.xxx.xxx", "RequestBody": "{ \"Content\": \"info@c-mes.co.uk\", \"LanguageCode\": \"en\", \"Asynch\": false }" }

Now that you have generated your first request, let's break down the response object. You will receive a JSON structure containing all the information you sent to the server. This allows you to verify the correct operation of your application using the C-MES API.

Company data (CompanyData object)

Represents the response of lead generation or enrichment returned by API methods based on the provided input data.

Returns:

  • CompanyName string

    The full legal name of the company as it appears in the analyzed transmitted materials.

  • LogoLink string

    Link to the company logo.

  • Address object
    • Country string

      Country.

    • State string

      State.

    • ZIP string

      Postal code.

    • City string

      City.

    • Street1 string

      Street and house number, office, etc.

    • Street2 string

      Address continuation.

  • Phones array of objects

    Phone numbers.

    • PhoneNumber string

      Phone number in international format: + Country code and telephone number.

    • Primary boolean

      True if it's the primary phone number of the company.

  • Emails array of objects

    Email addresses.

    • Email string

      E-mail address.

    • Primary boolean

      True if this is the primary company email address.

  • Webs array of objects

    The main website domain, without repetitions or 'http://' or 'https://'.

    • Host string

      Host name to a site page, not including http:// or https://.

    • Link string

      Link to a site page, not including http:// or https://.

  • Language string

    Language of communication of the company.

  • Contacts array of objects

    Contacts.

    • Name string

      Contact's first and last name.

    • JobPosition string

      Contact's job title.

    • Email string

      Contact's email.

    • Phone string

      Contact's phone number.

  • Business string

    Types of activity, services, goods, etc.

  • CompanySize string

    Assessment of the company size based on the information received.

  • Technologies array of strings

    Technologies on which the site is based.

  • Recommendations string

    Detailed recommendations for forming a commercial proposal for this customer.

  • EstimatedBudget numeric

    Estimate of the possible sales amount to this client in the next 12 months.

  • ProbabilityOfSuccess numeric

    Estimate in percentage of the probability of successfully concluding a contract.

  • AdditionalLinks array of objects

    Links found on the page, website.

    • Host string

      Host name to a site page, not including http:// or https://.

    • Link string

      Link to a site page, not including http:// or https://.

    • Description string

      Classify the link according to its contents.

  • SocialNetsLinks array of objects

    Links found on the page that lead to the company's pages on social networks.

    • Host string

      Host name to a site page, not including http:// or https://.

    • Link string

      Link to a site page, not including http:// or https://.

Enrichment

POST https://api.c-mes.tech/v1/enrichment

The enrichment method allows you to gather additional data about potential customer or supplier based on minimal information, such as an email address, company website, and email correspondence containing internet links to the company's site.

With its help, you can obtain comprehensive information about the company, including its industry, size, location, and contact details. This is very important, as enriched leads help better segment the audience, optimize marketing campaigns, and increase sales efficiency.

When providing information about the products and services you offer to the method, it can provide useful recommendations as well as assess the potential and likelihood of a deal. This enables your business to more accurately identify which leads hold the greatest value and focus on the most promising opportunities.

Request body:

  • Content string Required

    Any string data containing a link to the enriched lead. This can include a web link, email address, body of an email with the interested company's return email address, and so on.

  • Exceptions string Optional

    Specify this if you want to exclude mentioning these words in lead enrichment results. Words are separated by commas.

  • ProductsAndServices string Optional

    You can specify in this parameter the list and specifications of the products and services offered by your company for assessing the potential of the deal (probability, amount) and generating recommendations for further engagement with the company.

  • LanguageCode string Optional

    The language code in which the enrichment results should be presented. If the materials of the enriched lead are provided in another language, they will be translated into the specified language. The default is English (en).

  • Asynch boolean Optional

    Lead enrichment mode ('true' - asynchronous mode, 'false' - synchronous mode). In synchronous mode, the enrichment result is immediately returned to the client in the response, while in asynchronous mode, the client receives a request ID, which can later be used to obtain the result of the request execution or its completion percentage. It is recommended to use asynchronous mode if a long request execution time is anticipated. The default is 'false'.

  • OutWebHook string Optional

    A callback webhook triggered once the asynchronous task is completed. The payload includes the method's response in JSON format, along with all the incoming data provided to the method.

Returns

The request returns a CompanyData object: a JSON structure with the company data obtained from the enrichment results.

Example request

curl https://api.c-mes.tech/v1/enrichment \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "Content": "info@c-mes.co.uk", "ProductsAndServices": "Our company provides ready-made solutions for Odoo ERP and 1C:ERP WE, \ implements them, makes modifications, and offers support. We also provide consulting services \ in the field of business management.", "LanguageCode": "en", "Asynch": false }'

Response (JSON) Asynch = false

{ "CompanyName": "C-MES Solutions Ltd.", "LogoLink": "https://c-mes.co.uk/assets/images/logotop.png", "Address": { "Country": "United Kingdom", "State": "England", "ZIP": "W1U6TU", "City": "London", "Street1": "120 Baker Street", "Street2": "" }, "Phones": [ { "PhoneNumber": "+44 208 068 4673", "Primary": true } ], "Emails": [ { "Email": "info@c-mes.co.uk", "Primary": true } ], "Webs": [ { "Host": "c-mes.co.uk", "Link": "/" } ], "Language": "en", "Contacts": [], "Business": "C-MES Solutions Ltd. develops, publishes, and provides integrated business tools and innovative know-how for ERP-class systems including Odoo ERP and 1C: ERP. They offer advanced enterprise and production management methodologies, ERP implementation, system adaptation, training, and ongoing support.", "CompanySize": "Medium-sized enterprise, possibly ranging from 50 to 200 employees.", "Technologies": [ "odoo", "1C:ERP" ], "Recommendations": "Focus on offering ERP solutions, production management software, and consulting services related to the integration of these systems. Highlight the unique customization and support services that c-mes can benefit from.", "EstimatedBudget": 50000, "ProbabilityOfSuccess": 70, "AdditionalLinks": [ { "Host": "c-mes.co.uk", "Link": "/about/", "Description": "About" }, { "Host": "c-mes.co.uk", "Link": "/contacts/", "Description": "Contacts" }, { "Host": "c-mes.co.uk", "Link": "/products/", "Description": "ProductsAndServices" }, { "Host": "c-mes.co.uk", "Link": "/industries/", "Description": "Etc" }, { "Host": "c-mes.co.uk", "Link": "/legal/", "Description": "Legal" } ], "SocialNetsLinks": [ { "Host": "facebook.com", "Link": "/profile.php?id=100064998730941" }, { "Host": "linkedin.com", "Link": "/company/104615881" }, { "Host": "instagram.com", "Link": "/cmessolutionsltd/" }, { "Host": "x.com", "Link": "/c_mes_solutions" } ] }

Response (JSON) Asynch = true

{ "ID": "57bb5a9a-e115-4a0e-a15d-85527b82a344" }

Leadgeneration

POST https://api.c-mes.tech/v1/leadgeneration

The lead generation method is a process where your arbitrary queries are used to search for information about the companies of interest on the internet.

With this method, you can quickly gather data about potential clients, their products, services, and market activity.

Lead generation allows you to find companies that may be interested in your offerings, as well as analyze their needs and preferences. The leads are provided to the client in an enriched form after generation.

Request body:

  • Content string Required

    An arbitrary query, as if you were searching for companies on the internet through search engines. The more precise the query, the more complete and relevant the generated leads will be.

  • Exceptions string Optional

    Specify this if you want to exclude mentioning these words in lead enrichment results. Words are separated by commas.

  • ProductsAndServices string Optional

    You can specify in this parameter the list and specifications of the products and services offered by your company for assessing the potential of the deal (probability, amount) and generating recommendations for further engagement with the company.

  • MaxCount numeric Optional

    Limit on the maximum number of leads generated simultaneously. The default is 10.

  • LanguageCode string Optional

    The language code in which the enrichment results should be presented. If the materials of the enriched lead are provided in another language, they will be translated into the specified language. The default is English (en).

  • Asynch boolean Optional

    Lead generation mode ('true' - asynchronous mode, 'false' - synchronous mode). In synchronous mode, the enrichment result is immediately returned to the client in the response, while in asynchronous mode, the client receives a request ID, which can later be used to obtain the result of the request execution or its completion percentage. It is recommended to use asynchronous mode if a long request execution time is anticipated. The default is 'true'.

  • OutWebHook string Optional

    A callback webhook triggered once the asynchronous task is completed. The payload includes the method's response in JSON format, along with all the incoming data provided to the method.

Returns

The request returns an array of CompanyData objects: a JSON structure with the company data obtained from the generated and enrichment results.

Example request

curl https://api.c-mes.tech/v1/leadgeneration \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "Content": "Pipe manufacturers, USA", "ProductsAndServices": "Our company provides ready-made solutions for Odoo ERP and 1C:ERP WE, \ implements them, makes modifications, and offers support. We also provide consulting services \ in the field of business management.", "MaxCount": 10, "LanguageCode": "en", "Asynch": true }'

Response (JSON) Asynch = false

[ { "CompanyName": "CompanyName 1", "LogoLink": ".................", "Address": { "Country": "........", "State": "........", "ZIP": "....", "City": "......", "Street1": "", "Street2": "" }, ---------------------------------------- "EstimatedBudget": 50000, "ProbabilityOfSuccess": 60 } { "CompanyName": "CompanyName 2", "LogoLink": ".................", "Address": { "Country": "........", "State": "........", "ZIP": "....", "City": "......", "Street1": "", "Street2": "" }, ---------------------------------------- { "CompanyName": "CompanyName 3", "LogoLink": ".................", "Address": { "Country": "........", "State": "........", "ZIP": "....", "City": "......", "Street1": "", "Street2": "" }, ---------------------------------------- MaxCount ---------------------------------------- ]

Response (JSON) Asynch = true

{ "ID": "57bb5a9a-e115-4a0e-a15d-85527b82a344" }

Knowledgebase create

POST https://api.c-mes.tech/v1/knowledgebase/create

Creates a new knowledge base and returns its identifier.

The knowledge base can include any type of information within its articles, which will be transformed into vector format and leveraged by AI assistants to deliver smarter and faster results.

Request body:

  • Name string Required

    Knowledge base name.

  • Body string Optional

    Knowledge base description.

  • KnowledgebaseID string Optional

    Knowledge base ID.

  • KnowledgebaseExternalID numeric Optional

    Knowledge base external ID.

  • KnowledgebaseCode numeric Optional

    Knowledge base code.

Returns

Returns a JSON object.

  • KnowledgebaseID string Required

    Knowledgebase ID.

  • KnowledgebaseCode numeric Required

    Knowledgebase code.

  • KnowledgebaseExternalID numeric Required

    Knowledgebase external ID.

Example request

curl https://api.c-mes.tech/v1/knowledgebase/create \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "name": "C-MES Solutions Ltd", "body": "Company description for job of sales assistant robot", "knowledgebaseexternalid": 15051 }'

Response (JSON)

{ "KnowledgebaseID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "KnowledgebaseCode": 2140, "KnowledgebaseExternalID": 15051 }

Knowledgebase info

POST https://api.c-mes.tech/v1/knowledgebase/info

Returns information about the knowledge base.

Request body:

It is required to provide one of the available identifiers.

  • KnowledgebaseID string Optional

    Knowledge base ID.

  • OR:

  • KnowledgebaseExternalID numeric Optional

    Knowledge base external ID.

  • OR:

  • KnowledgebaseCode numeric Optional

    Knowledge base code.

Returns

Returns a JSON object.

  • ID string Required

    Knowledgebase ID.

  • ExternalID numeric Required

    Knowledgebase external ID.

  • Code numeric Required

    Knowledgebase code.

  • Name string Required

    Knowledgebase name.

  • Body string Required

    Knowledgebase description.

  • Content string Required

    The vector corresponding to the knowledge base.

  • EntriesCount numeric Required

    Number of articles in the knowledge base.

  • Tokens numeric Required

    Total number of tokens in the knowledge base.

  • IsIndexed boolean Required

    Indicator that the content of the knowledge base is vectorized.

Example request

curl https://api.c-mes.tech/v1/knowledgebase/info \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "knowledgebaseexternalid": 15051 }'

Response (JSON)

{ "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "Code": 2140, "ExternalID": 15051, "Name": "C-MES Solutions Ltd", "Body": "Company description for job of sales assistant robot", "Content": "c-mes collaborative manufacturing execution system software product solution erp systems planning scheduling coordinating optimising synchronising analysing production shop floor management system production management enterprise odoo erp 1c:erp we ............", "EntriesCount": 64, "TotalTokens": 16090, "IsIndexed": true }

Knowledgebase delete

POST https://api.c-mes.tech/v1/knowledgebase/delete

Deletes the knowledge base and all its articles.

Request body:

It is required to provide one of the available identifiers.

  • KnowledgebaseID string Optional

    Knowledge base ID.

  • OR:

  • KnowledgebaseExternalID numeric Optional

    Knowledge base external ID.

  • OR:

  • KnowledgebaseCode numeric Optional

    Knowledge base code.

Returns

Returns a JSON object:

  • KnowledgebaseID string Required

    Knowledgebase ID.

  • KnowledgebaseCode numeric Required

    Knowledgebase code.

  • KnowledgebaseExternalID numeric Required

    Knowledgebase external ID.

  • Status string Required

    Returns 'Success' if the knowledge base is successfully deleted.

Example request

curl https://api.c-mes.tech/v1/knowledgebase/delete \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "knowledgebaseexternalid": 15051 }'

Response (JSON)

{ "KnowledgebaseID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "KnowledgebaseCode": 2140, "KnowledgebaseExternalID": 15051, "Status": "Success" }

Knowledgebase entry create

POST https://api.c-mes.tech/v1/knowledgebase/entry/create

Creates a new article in the knowledge base and returns its identifier.

Request body:

    It is required to provide one of the available identifiers.

  • KnowledgebaseID string Optional

    Knowledge base ID.

  • OR:

  • KnowledgebaseExternalID numeric Optional

    Knowledge base external ID.

  • OR:

  • KnowledgebaseCode numeric Optional

    Knowledge base code.

  • It is required to provide one of the available identifiers.

  • ParentID string Optional

    ID of the parent article (section) in the knowledge base.

  • OR:

  • ParentExternalID numeric Optional

    External ID of the parent article (section) in the knowledge base.

  • OR:

  • ParentCode numeric Optional

    Code of the parent article (section) in the knowledge base.

  • Identifiers for the article are specified when necessary.

  • ID string Optional

    ID of the article (section) in the knowledge base.

  • ExternalID numeric Optional

    External ID of the article (section) in the knowledge base.

  • Code numeric Optional

    Code of the article (section) in the knowledge base.

  • Name string Required

    Article name.

  • Body string Optional

    Content of the knowledge base article (in text or HTML format).

Returns

Returns a JSON object:

  • ID string Required

    Article ID.

  • Code numeric Required

    Article code.

  • ExternalID numeric Required

    Article external ID.

Example request

curl https://api.c-mes.tech/v1/knowledgebase/entry/create \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "name": "C-MES Solutions Ltd. (Main)", "body": "C-MES (Collaborative Manufacturing Execution System) is a software product and solution integrated into ERP systems designed ....", "knowledgebaseexternalid": 15051, "externalid": 15052, "parentexternalid": 15051 }'

Response (JSON)

{ "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a620", "Code": 2141, "ExternalID": 15052 }

Knowledgebase entry update

POST https://api.c-mes.tech/v1/knowledgebase/entry/update

Update a article in the knowledge base and returns its identifier.

Request body:

    It is required to provide one of the available identifiers.

  • KnowledgebaseID string Optional

    Knowledge base ID.

  • OR:

  • KnowledgebaseExternalID numeric Optional

    Knowledge base external ID.

  • OR:

  • KnowledgebaseCode numeric Optional

    Knowledge base code.

  • It is required to provide one of the available identifiers.

  • ParentID string Optional

    ID of the parent article (section) in the knowledge base.

  • OR (AND):

  • ParentExternalID numeric Optional

    External ID of the parent article (section) in the knowledge base.

  • OR (AND):

  • ParentCode numeric Optional

    Code of the parent article (section) in the knowledge base.

  • It is required to provide one of the available identifiers.

  • ID string Optional

    ID of the article (section) in the knowledge base.

  • OR (AND):

  • ExternalID numeric Optional

    External ID of the article (section) in the knowledge base.

  • OR (AND):

  • Code numeric Optional

    Code of the article (section) in the knowledge base.

  • Name string Optional

    Article name.

  • Body string Optional

    Content of the knowledge base article (in text or HTML format).

Returns

Returns a JSON object.

  • ID string Required

    Article ID.

  • Code numeric Required

    Article code.

  • ExternalID numeric Required

    Article external ID.

Example request

curl https://api.c-mes.tech/v1/knowledgebase/entry/update \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "body": "ERP systems designed ....", "knowledgebaseexternalid": 15051, "externalid": 15052 }'

Response (JSON)

{ "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a620", "Code": 2141, "ExternalID": 15052 }

Knowledgebase entry delete

POST https://api.c-mes.tech/v1/knowledgebase/entry/delete

Delete a article in the knowledge base and returns its identifier.

Request body:

    It is required to provide one of the available identifiers.

  • KnowledgebaseID string Optional

    Knowledge base ID.

  • OR:

  • KnowledgebaseExternalID numeric Optional

    Knowledge base external ID.

  • OR:

  • KnowledgebaseCode numeric Optional

    Knowledge base code.

  • It is required to provide one of the available identifiers.

  • ID string Optional

    ID of the article (section) in the knowledge base.

  • OR:

  • ExternalID numeric Optional

    External ID of the article (section) in the knowledge base.

  • OR:

  • Code numeric Optional

    Code of the article (section) in the knowledge base.

Returns

Returns a JSON object.

  • ID string Required

    Article ID.

  • Code numeric Required

    Article code.

  • ExternalID numeric Required

    Article external ID.

Example request

curl https://api.c-mes.tech/v1/knowledgebase/entry/delete \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "knowledgebaseexternalid": 15051, "externalid": 15052 }'

Response (JSON)

{ "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a620", "Code": 2141, "ExternalID": 15052 }

Knowledgebase list

GET https://api.c-mes.tech/v1/knowledgebase/list

Returns a list of all knowledge bases.

Returns

Returns a JSON. Array of object:

  • ID string Required

    Knowledge base ID.

  • ExternalID numeric Required

    Knowledge base ExternalID.

  • Code numeric Required

    Knowledge base Code.

  • Name string Required

    Knowledge base Name.

  • Body string Required

    Knowledge base Description.

  • Content string Required

    The vector corresponding to the knowledge base.

  • EntriesCount numeric Required

    Number of articles in the knowledge base.

  • Tokens numeric Required

    Total number of tokens in the knowledge base.

  • IsIndexed boolean Required

    Indicator that the content of the knowledge base is vectorized.

Example request

curl https://api.c-mes.tech/v1/knowledgebase/list \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \

Response (JSON)

[ { "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "ExternalID": 15051, "Code": 2140, "Name": "C-MES Solutions Ltd", "Body": "Company description for job of sales assistant robot", "Content": "c-mes collaborative manufacturing execution system software product solution erp systems planning scheduling coordinating optimising synchronising analysing production shop floor management system production management enterprise odoo erp 1c:erp we ............", "EntriesCount": 64, "TotalTokens": 16090, "IsIndexed": true } ]

Assistant create

POST https://api.c-mes.tech/v1/assistant/create

Creates a new channel - a dialogue with the assistant.

In dialogue mode, the assistant automatically retrieves the necessary information from the knowledge base to generate responses.

Request body:

  • ID string Optional

    ID of the assistant's dialogue channel.

  • ExternalID numeric Optional

    ExternalID of the assistant's dialogue channel.

  • System string Optional

    System prompt of the assistant. Instruction for generating responses in the dialogue channel.

  • User string Optional

    The name/ID of the user in the conversation channel.

  • Assistant string Optional

    The name/ID of the assistant in the conversation channel.

Returns

Returns a JSON object.

  • ID string Required

    Dialogue channel ID.

  • ExternalID numeric Required

    Dialogue channel ExternalID.

  • Status string Required

    Returns 'Success' if the dialogue channel is successfully created

Example request

curl https://api.c-mes.tech/v1/assistant/create \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "system": "You are a sales assistant at C-MES Solutions Ltd.", "user": "WebSiteVisitor #23094990", "assistant": "Sales assistant" }'

Response (JSON)

{ "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "ExternalID": 0, "Status": "Success" }

Assistant update

POST https://api.c-mes.tech/v1/assistant/update

Updates the dialogue channel data, including the current context and activity.

Request body:

    It is required to provide one of the available identifiers.

  • ID string Optional

    ID of the assistant's dialogue channel.

  • OR (AND):

  • ExternalID numeric Optional

    ExternalID of the assistant's dialogue channel.

  • System string Optional

    System prompt of the assistant. Instruction for generating responses in the dialogue channel.

  • User string Optional

    The name/ID of the user in the conversation channel.

  • Assistant string Optional

    The name/ID of the assistant in the conversation channel.

  • Context string Optional

    Current dialogue context or its title for identification in the dialogue list.

  • IsActive boolean Optional

    Indicator of an active dialogue.

Returns

Returns a JSON object.

  • ID string Required

    Dialogue channel ID.

  • ExternalID numeric Required

    Dialogue channel ExternalID.

  • Status string Required

    Returns 'Success' if the dialogue channel is successfully updated

Example request

curl https://api.c-mes.tech/v1/assistant/update \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "id": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "externalid": 890, "user": "John Smith" }'

Response (JSON)

{ "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "ExternalID": 890, "Status": "Success" }

Assistant delete

POST https://api.c-mes.tech/v1/assistant/delete

Deletes all information of the dialogue channel, including the message history.

Request body:

    It is required to provide one of the available identifiers.

  • ID string Optional

    ID of the assistant's dialogue channel.

  • OR:

  • ExternalID numeric Optional

    ExternalID of the assistant's dialogue channel.

Returns

Returns a JSON object.

  • ID string Required

    Dialogue channel ID.

  • ExternalID numeric Required

    Dialogue channel ExternalID.

  • Status string Required

    Returns 'Success' if the dialogue channel is successfully deleted.

Example request

curl https://api.c-mes.tech/v1/assistant/delete \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "id": "66bb5a0a-a125-4a7d-a22d-85527c82a590" }'

Response (JSON)

{ "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "ExternalID": 890, "Status": "Success" }

Assistant history

POST https://api.c-mes.tech/v1/assistant/history

Returns the dialogue channel history with the assistant, including the current context and the message history.

Request body:

    It is required to provide one of the available identifiers.

  • ID string Optional

    ID of the assistant's dialogue channel.

  • OR:

  • ExternalID numeric Optional

    ExternalID of the assistant's dialogue channel.

Returns

Returns a JSON object.

  • User string Required

    Dialogue channel User name.

  • Assistant string Required

    Dialogue channel Assistant name.

  • Context string Required

    Dialogue channel Context.

  • Messages array of objects

    Message history of the dialogue channel.

    • Period date

      Message date and time.

    • ChannelID string

      Channel ID.

    • ID string

      Message ID.

    • ExternalID numeric

      Message ExternalID.

    • KnowledgeBase array of numeric

      Array of numeric codes of the knowledge base articles used in the response.

    • Role string

      Role of the dialogue participant: 'user' or 'assistant'.

    • Message string

      Dialogue message text.

  • Status string Required

    Returns 'Success' if the dialogue history is successfully retrieved.

Example request

curl https://api.c-mes.tech/v1/assistant/history \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "id": "66bb5a0a-a125-4a7d-a22d-85527c82a590" }'

Response (JSON)

{ "User": "John Smith", "Assistant": "Sales assistant", "Context": "The parties are currently engaged in a regular conversation.", "Messages": [ { "Period": "2024-04-27T12:00:00Z", "ChannelID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "ID": "88bb5a0a-a125-4a7d-a22d-85527c82a600", "ExternalID": 10258, "KnowledgeBase": [], "Role": "user", "Message": "Hello! I would like to learn more about the products and services your company offers." } ], "Status": "Success" }

Assistant message

POST https://api.c-mes.tech/v1/assistant/message

Sends a new user message to the dialogue channel or updates an existing one if a message with the same ID is found. If no such user message exists, a new one is created. Assistant responses are triggered exclusively by newly created user messages, ensuring real-time interaction and relevance.

Request body:

  • Period date Optional

    Date and time of the submitted message. If not specified, the current date and time will be used by default.

  • It is required to provide one of the available identifiers.

  • ChannelID string Optional

    ID of the assistant's dialogue channel.

  • OR:

  • ChannelExternalID numeric Optional

    ExternalID of the assistant's dialogue channel.

  • To create new messages, the identifier can be left empty. To update existing messages, one of the existing identifiers must be specified.

  • ID string Optional

    Message ID in the dialogue channel.

  • OR (AND):

  • ExternalID numeric Optional

    Message ExternalID in the dialogue channel.

  • Message string Required

    User message in the dialogue channel.

  • KnowledgeBase array Optional

    An array of numeric codes referencing knowledge base articles for response generation. If omitted, the assistant will automatically select the most relevant articles based on the context.

  • Additionally string Optional

    Optional additional materials to be transmitted to the dialogue channel, either in plain text or Base64 format.

  • Role string Optional

    Role of the message author ('user', 'assistant'). Used when loading the initial dialogue state.

  • Asynch boolean Optional

    Option to trigger the response to a message in asynchronous mode. Default is 'false'.

  • OutWebHook string Optional

    A callback webhook triggered once the asynchronous task is completed. The payload includes the method's response in JSON format, along with all the incoming data provided to the method.

Returns

Returns a JSON object.

  • UsersID string Required

    Assigned user message ID in the dialogue.

  • AssistantID string Required

    Assigned assistant message ID in the dialogue.

  • Context string Required

    Dialogue channel context.

  • Message string Required

    Dialogue message text.

  • Status string Required

    Returns in case of 'Success' response generation by the assistant to the user message.

Example request

curl https://api.c-mes.tech/v1/assistant/message \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "ChannelID": "66bb5a0a-a125-4a7d-a22d-85527c82a590" "externalid": 1877, "Message": "Hello! I would like to learn more about the products and services your company offers." }'

Response (JSON)

{ "UsersID": "88bb5a0a-a125-4a7d-a22d-85527c82a600", "AssistantID": "67bb5a0a-a125-4a7d-a22d-85527c82a900", "Context": "The parties are currently engaged in a regular conversation.", "Message": "Hello, John! Thank you for reaching out. At C-MES Solutions Ltd., we specialize in providing cutting-edge solutions to help businesses optimize their processes. Our products and services include AI-driven automation tools, ERP integration, and custom API development to streamline your workflow. Whether you're looking to enhance your customer experience or improve internal efficiency, we have tailored solutions to meet your needs. Feel free to ask for more details on any of our offerings!", "Status": "Success" }

Assistant list

GET https://api.c-mes.tech/v1/assistant/list

Returns a list of all dialogue channels with assistants.

Returns

Returns a JSON. Array of object:

  • ID string Required

    Assistant ID.

  • ExternalID numeric Required

    Assistant ExternalID.

  • User string Required

    Dialogue channel User name.

  • Assistant string Required

    Dialogue channel Assistant name.

  • System string Required

    System prompt of the assistant. Instruction for generating responses in the dialogue channel.

  • Context string Required

    Current dialogue context or its title for identification in the dialogue list.

  • IsActive boolean Required

    Indicator of an active dialogue.

Example request

curl https://api.c-mes.tech/v1/assistant/list \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \

Response (JSON)

[ { "ID": "66bb5a0a-a125-4a7d-a22d-85527c82a590", "ExternalID": 890, "User": "John Smith", "Assistant": "Sales assistant", "System": "You are a sales assistant at C-MES Solutions Ltd.", "Context": "The parties are currently engaged in a regular conversation.", "IsActive": true } ]

Getresult

POST https://api.c-mes.tech/v1/getresult

Returns the result of the previously sent request or the current % of completion.

Request body:

  • ID string Required

    A unique request identifier previously returned by methods using asynchronous call mode.

Returns

Returns a JSON object - the result of the previously sent request or the current % of completion.

Example request

curl https://api.c-mes.tech/v1/leadgeneration \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "ID" = "57bb5a9a-e115-4a0e-a15d-85527b82a344" }'

Response (JSON)

[ { "CompanyName": "CompanyName 1", "LogoLink": ".................", "Address": { "Country": "........", "State": "........", "ZIP": "....", "City": "......", "Street1": "", "Street2": "" }, ---------------------------------------- "EstimatedBudget": 50000, "ProbabilityOfSuccess": 60 } { "CompanyName": "CompanyName 2", "LogoLink": ".................", "Address": { "Country": "........", "State": "........", "ZIP": "....", "City": "......", "Street1": "", "Street2": "" }, ---------------------------------------- { "CompanyName": "CompanyName 3", "LogoLink": ".................", "Address": { "Country": "........", "State": "........", "ZIP": "....", "City": "......", "Street1": "", "Street2": "" }, ---------------------------------------- MaxCount ---------------------------------------- ]

Response (JSON)

{ "Status" = "Request in processing", "Progress" = 85 }

Balance

GET https://api.c-mes.tech/v1/info/balance

Returns the current balance of the account.

Returns

Returns a JSON object:

  • Balance numeric Required

    Current balance amount.

  • Currency string Required

    Balance currency.

Example request

curl https://api.c-mes.tech/v1/info/balance \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \

Response (JSON)

{ "Balance" = 25, "Currency" = "GBP" }

Statistics

POST https://api.c-mes.tech/v1/info/statistics

Returns API usage statistics in various dimensions for the specified period.

Request body:

  • Start date Required

    Start date of the selection in ISO format.

  • End date Required

    End date of the selection in ISO format.

  • Type string Optional

    Grouping option: "Project", "Service". If the value is not specified or the value is "All," it returns all data - project, service, api_key.

  • Period string Optional

    Grouping option: "Day", "Month". If the value is not specified or the value is "All," it returns all records without grouping.

Returns

Returns a JSON object containing an array of records, each corresponding to one group of values:

  • Period date Required

    Period of resource consumption records. If the grouping is "Day," it contains the start date of the day of consumption; if "Month," it contains the start date of the month of consumption. If "All," it contains the date and time of the request.

  • Sum numeric Required

    Total resource consumption for the selected period.

  • Currency string Required

    Currency.

  • Service string Optional

    Name of the service, in case the grouping is set to "Service" or "All."

  • Project string Optional

    Name of the project, in case the grouping is set to "Project" or "All."

  • ApiKey string Optional

    Name of the ApiKey, in case the grouping is set to "All."

Example request

curl https://api.c-mes.tech/v1/info/statistics \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "start":"2024-11-01T17:04:56.094Z", "end":"2024-11-30T17:04:56.094Z", "type":"service", "period":"day" }'

Response (JSON)

[ { "Period": "2024-11-05T00:00:00", "Sum": 0.6, "Currency": "GBP", "Service": "/v1/enrichment" } ]

Tariffs

GET https://api.c-mes.tech/v1/info/tariffs

Returns an array of current rates in currencies GBP, EUR, USD. Authentication is not required.

Returns

Returns a JSON object containing an array of records:

  • Method string Required

    Name of the service.

  • Description string Required

    Service description.

  • PriceRules string Required

    Pricing rules, cost determination.

  • PriceGBP numeric Required

    Base price in GBP. The rate in other currencies is calculated based on it according to the current exchange rates in the system.

  • PriceEUR numeric Required

    Price in Euros.

  • PriceUSD numeric Required

    Price in Dollars.

Example request

curl https://api.c-mes.tech/v1/info/tariffs \ -H "Content-Type: application/json" \

Response (JSON)

[ { "Method": "/v1/leadgeneration", "Description": "Price per generated lead", "PriceRules" : "", "PriceGBP": 0.1, "PriceEUR": 0.1196988, "PriceUSD": 0.1340148 }, { "Method": "/v1/enrichment", "Description": "Price per successfully enriched lead", "PriceRules" : "", "PriceGBP": 0.1, "PriceEUR": 0.1196988, "PriceUSD": 0.1340148 } ]

Echo

POST https://api.c-mes.tech/v1/echo
GET https://api.c-mes.tech/v1/echo

Method for testing requests and checking the API functionality.

Request body: Any data.

Returns

Returns a JSON object:

  • RequestType string Required

    Type of the transmitted request.

  • ApiKey string Required

    API key used for authorization.

  • Content-Type string Required

    Value of Content-Type sent in the request header.

  • Content-Lenght numeric Required

    Length of the request body.

  • Method string Required

    Called request method.

  • Status string Required

    The request was successfully completed

  • IP string Required

    Client IP.

  • RequestBody string Required

    Request body sent to the server.

Example request

curl https://api.c-mes.tech/v1/echo \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ -d '{ "start":"2024-11-01T17:04:56.094Z", "end":"2024-11-30T17:04:56.094Z", "type":"service", "period":"day" }'

Response (JSON)

{ "RequestType": "POST", "ApiKey": "apikey-5*****************91", "Content-Type": "application/json", "Method": "/v1/echo", "Content-Lenght": 131, "Status": "The request was successfully completed", "IP": "xxx.xxx.xxx.xxx", "RequestBody": "{\r\n \"start\": \"2024-11-01T17:04:56.094Z\",\r\n \"end\": \"2024-11-30T17:04:56.094Z\",\r\n \"type\": \"service\",\r\n \"period\": \"day\"\r\n}" }

Server response codes

Code Description
200 OK
202 The request has been accepted, but its processing has not yet been completed
401 Authorization error
402 Not enough money
403 API Key is not valid
405 Error in request
500 Internal Server Error