Documentation / MCP / campaigns_saved_opportunity_update

campaigns_saved_opportunity_update

POSThttps://mcp.oppalerts.com/mcptool: campaigns_saved_opportunity_update

Changes one saved opportunity of a campaign. The call replaces the whole saved opportunity.

What it does

The tool changes one saved opportunity of a campaign. Send every field: the call replaces the whole saved opportunity, and an optional field you leave out is cleared.

A change to the search, the type, the numbers, the words, the vector, or the similarity text deletes the stored daily counts of this saved opportunity. The daily count job then counts the missing days again on its next run. Changing only the label keeps the counts.

The response contains the saved opportunity after the change. In the web app, the change shows on the Opportunities tab of Edit Campaign.

Who May Call It

  • The account owner, an account editor, or a campaign editor of this campaign. An account viewer or a campaign viewer gets the error no_access.
  • The token or the connection needs the scope api:write, and mcp:use as every MCP tool does. Without api:write, the call gets the error forbidden. Authentication says which tokens and apps have it.
  • The tool tells the MCP client that it changes data, so a client such as Claude asks you before the call.

Connect

claude mcp add --transport http oppalerts https://mcp.oppalerts.com/mcp

The first call opens a browser window for the OppAlerts login. Allow changes there. Connect an AI Agent has the details.

Parameters

campaignint, required, 1 to 4294967295
The campaign id, from campaigns_list. It must be a campaign of your account.
opportunityint, required, 1 to 4294967295
Required. The saved opportunity id, from campaigns_saved_opportunities.
labelstring, required, at most 255 characters
Required. The name of the saved opportunity, at most 255 characters. It must be different from the names of the other saved opportunities of the campaign.
searchstring, required
Required. What the saved opportunity finds. no_type finds pages by the vector, the words, or both, with no type. opportunity_type finds the pages of the opportunity type in opportunity_type, and content_type the pages of the content type in content_type, at or above type_score_min. The other 6 values are the brand searches: they read the organizations of the campaign, and they take only the PR, PRoT, and link fields. Values: no_type, opportunity_type, content_type, brand_links, brand_mentions, unlinked_brand_mentions, brand_link_gap, competitor_links, and competitor_mentions.
opportunity_typestring, required for some calls, at most 120 characters
Required for search opportunity_type, and refused for every other search. An opportunity type as <group>/<type>, for example advertising/newsletter-ads, from types_opportunity_types, at most 120 characters.
content_typestring, required for some calls, at most 120 characters
Required for search content_type, and refused for every other search. A content type, for example blogs, from types_content_types, at most 120 characters.
type_score_minint, required for some calls, 1 to 100
Required for search opportunity_type and content_type, and refused for every other search. The least type score a page must have, a whole number from 1 to 100. 0 is refused. Each page has one score for each type, from 0 to 100.
similarity_targetstring, required for some calls
Required for search no_type, opportunity_type, and content_type, and refused for a brand search: the vector the pages must be semantically similar to. none is no vector: the words alone find the pages. campaign is the market description of the campaign. similarity_text is the text in similarity_text. Values: none, campaign, and similarity_text.
similarity_textstring, required for some calls, at most 20000 characters
Required when similarity_target is similarity_text, and refused for another similarity_target or a brand search: the text the pages must be semantically similar to, at most 1,000 words and at most 20,000 characters. A text that is too long is refused, never cut. A text of only spaces is refused.
similarity_score_minint, required for some calls, 1 to 100
Required when similarity_target is campaign or similarity_text, and refused when it is none or for a brand search: the least similarity in percent, 1 to 100. It applies on both indexes.
title_querystring, optional, at most 500 characters
Optional, and refused for a brand search. Words the title must have, at most 500 characters. It takes these search operators: AND, OR, MAYBE, NEAR/N, and NOTNEAR/N in capitals, the Negation operator (-), the Phrase search operator, the Proximity search operator (~N), the Exact form modifier (=), the IDF boost modifier (^N), the Wildcard operator (* at the end of a word), and Grouping with parentheses (one level). A wrong use is refused with a sentence that names the field. The full list is in the documentation: https://oppalerts.com/docs/the-data/advanced-search-operators. At most 20 words or phrases: a text with more is refused, and nothing is cut. A text with no word or phrase, such as only OR or only spaces, is refused. Leave it out for no title words.
body_querystring, optional, at most 500 characters
Optional, and refused for a brand search. Words the body must have, at most 500 characters, with the rules of title_query. Leave it out for no body words.
title_body_joinstring, required for some calls
Required when both title_query and body_query are sent, and refused otherwise. and: a page must match both. or: a page must match one of them. Values: and and or.
pr_domain_minint, optional, 0 to 100
Optional. Keep the pages whose domain PageRank is at least this value, a whole number from 0 to 100. 0 applies no minimum. Not sent: no minimum. Refused when it is above pr_domain_max.
pr_domain_maxint, optional, 1 to 100
Optional. Keep the pages whose domain PageRank is at most this value, a whole number from 1 to 100. 100 applies no maximum, the same as not sent: a page with no domain PageRank stays in the results. 0 is refused. Not sent: no maximum.
pr_host_minint, optional, 0 to 100
Optional. Keep the pages whose host PageRank is at least this value, a whole number from 0 to 100. 0 applies no minimum. Not sent: no minimum. Refused when it is above pr_host_max.
pr_host_maxint, optional, 1 to 100
Optional. Keep the pages whose host PageRank is at most this value, a whole number from 1 to 100. 100 applies no maximum, the same as not sent: a page with no host PageRank stays in the results. 0 is refused. Not sent: no maximum.
prot_domain_minint, optional, 0 to 1000000
Optional. Keep the pages whose domain PRoT is at least this value, a whole number from 0 to 1000000. PRoT (PageRank over Time) is the sum of the monthly PageRank values of the domain. 0 applies no minimum. Not sent: no minimum. Refused when it is above prot_domain_max.
prot_domain_maxint, optional, 1 to 1000000
Optional. Keep the pages whose domain PRoT is at most this value, a whole number from 1 to 1000000. PRoT (PageRank over Time) is the sum of the monthly PageRank values of the domain. 0 is refused. Not sent: no maximum.
prot_host_minint, optional, 0 to 1000000
Optional. Keep the pages whose host PRoT is at least this value, a whole number from 0 to 1000000. PRoT (PageRank over Time) is the sum of the monthly PageRank values of the host. 0 applies no minimum. Not sent: no minimum. Refused when it is above prot_host_max.
prot_host_maxint, optional, 1 to 1000000
Optional. Keep the pages whose host PRoT is at most this value, a whole number from 1 to 1000000. PRoT (PageRank over Time) is the sum of the monthly PageRank values of the host. 0 is refused. Not sent: no maximum.
link_counts_minobject, optional
Optional. The least number of outbound links of each link type in each page section, the shape that prospects_search takes: {"article"|"nav"|"comments": {"follow"|"nofollow"|"sponsored"|"ugc": n}}. A page must have at least n links of that type in that section. Leave it out, or leave out a section or a link type, for no minimum.
link_counts_min.articleobject, optional
Optional. The article section of the page.
link_counts_min.article.followint, optional, 0 to 4294967295
Optional. The least number of follow links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.article.nofollowint, optional, 0 to 4294967295
Optional. The least number of nofollow links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.article.sponsoredint, optional, 0 to 4294967295
Optional. The least number of rel=sponsored links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.article.ugcint, optional, 0 to 4294967295
Optional. The least number of rel=ugc links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.navobject, optional
Optional. The navigation section of the page.
link_counts_min.nav.followint, optional, 0 to 4294967295
Optional. The least number of follow links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.nav.nofollowint, optional, 0 to 4294967295
Optional. The least number of nofollow links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.nav.sponsoredint, optional, 0 to 4294967295
Optional. The least number of rel=sponsored links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.nav.ugcint, optional, 0 to 4294967295
Optional. The least number of rel=ugc links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.commentsobject, optional
Optional. The comments section of the page, where visitors add content.
link_counts_min.comments.followint, optional, 0 to 4294967295
Optional. The least number of follow links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.comments.nofollowint, optional, 0 to 4294967295
Optional. The least number of nofollow links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.comments.sponsoredint, optional, 0 to 4294967295
Optional. The least number of rel=sponsored links in that section, a whole number of 0 or more. 0 applies no minimum.
link_counts_min.comments.ugcint, optional, 0 to 4294967295
Optional. The least number of rel=ugc links in that section, a whole number of 0 or more. 0 applies no minimum.

Rules

  • opportunity is required. campaigns_saved_opportunities gives the id.
  • An optional field that you leave out becomes none.
  • label and search are required. The label must be different from the labels of the other saved opportunities of the campaign.
  • For search no_type, opportunity_type, and content_type: similarity_target is required.
  • similarity_score_min is required with a vector, that is when similarity_target is campaign or similarity_text. It is refused when similarity_target is none.
  • similarity_text is required when similarity_target is similarity_text, and refused for another value.
  • opportunity_type and type_score_min are required for search opportunity_type. content_type and type_score_min are required for search content_type. Each one is refused for every other search.
  • A vector or words are required: a call with similarity_target none, no title_query, and no body_query is refused with nothing_to_search.
  • title_body_join is required when both title_query and body_query are sent, and refused otherwise.
  • A brand search (brand_links, brand_mentions, unlinked_brand_mentions, brand_link_gap, competitor_links, or competitor_mentions) takes only the PR, PRoT, and link fields. It refuses title_query, body_query, title_body_join, and every vector field.
  • The PR, PRoT, and link fields are optional. A field that you leave out is no minimum or no maximum. A minimum above its maximum is refused with min_above_max.
  • A PR maximum takes 1 to 100, and a PRoT maximum takes 1 to 1,000,000. 0 is refused with rank_out_of_range. A PR maximum of 100 applies no maximum, the same as not sent.
  • type_score_min takes 1 to 100. 0 is refused.
  • A similarity text that is too long is refused, never cut.
  • title_query and body_query take the search operators of Advanced Search Operators. A query with a formatting error is refused with query_operator, and it is not saved. The sentence names the field, says that the query has a formatting error, and says what the error is.

Strict Rules

  • A field that is not in the list above is refused. The result then has isError true, and its text starts with bad_param. The error names the field: "<field> is not a field of this tool."
  • A bad value is refused, and the error names the field. A bad value is a value of the wrong type, a number with a fraction for a whole-number field, a value out of its range, a value that is not in its list, or an empty text, list, or object. A required field that you do not send is refused too. To send no value for an optional field, leave the field out. No field has a default value, and the tool never changes a value that you send.
  • An error about the format of a call, such as a refused field, names the field. Its message ends with one sentence: "Read the documentation at https://oppalerts.com/docs for the correct format." Every other error, such as forbidden below, has only its own sentence.

Response fields

The response contains the saved opportunity, in the same format that campaigns_saved_opportunities returns for each saved opportunity.

opportunity.idint
The id of the saved opportunity. news_opportunities and prospects_opportunities take it as opportunity.
opportunity.labelstring
The name of the saved opportunity.
opportunity.statestring
The state of the saved opportunity. The example shows active.
opportunity.searchstring
What the saved opportunity finds: no_type, opportunity_type, content_type, or one of the 6 brand searches brand_links, brand_mentions, unlinked_brand_mentions, brand_link_gap, competitor_links, and competitor_mentions.
opportunity.opportunity_typestring
The opportunity type as <group>/<type>, for search opportunity_type. Empty for another search.
opportunity.content_typestring
The content type, for search content_type. Empty for another search.
opportunity.filtersobject
The numeric fields of the saved opportunity. A number that is not set is not in filters.
opportunity.filters.type_score_minint, optional
The minimum type score, 0 to 100.
opportunity.filters.similarity_score_minint, optional
The minimum similarity in percent, 1 to 100.
opportunity.filters.pr_domain_minint, optional
The minimum domain PageRank, 0 to 100.
opportunity.filters.pr_domain_maxint, optional
The maximum domain PageRank, 0 to 100.
opportunity.filters.pr_host_minint, optional
The minimum host PageRank, 0 to 100.
opportunity.filters.pr_host_maxint, optional
The maximum host PageRank, 0 to 100.
opportunity.filters.prot_domain_minint, optional
The minimum domain PRoT (PageRank over Time), 0 to 1000000.
opportunity.filters.prot_domain_maxint, optional
The maximum domain PRoT, 0 to 1000000.
opportunity.filters.prot_host_minint, optional
The minimum host PRoT, 0 to 1000000.
opportunity.filters.prot_host_maxint, optional
The maximum host PRoT, 0 to 1000000.
opportunity.filters.link_counts_min.articleobject, optional
The minimum number of outbound links in the article section of a page, for each link type: follow, nofollow, sponsored, and ugc. A saved opportunity with no link minimum has no link_counts_min.
opportunity.filters.link_counts_min.navobject, optional
The same, for the navigation section of a page.
opportunity.filters.link_counts_min.commentsobject, optional
The same, for the comments section of a page.
opportunity.similarity_targetstring
What the pages must be semantically similar to: none, campaign, or similarity_text. Empty when it is not set.
opportunity.similarity_textstring
The text of similarity_target similarity_text. Empty when it is not set.
opportunity.vector_readybool
true when the vector of the similarity_text of the saved opportunity is made.
opportunity.title_querystring
The words the title must have. Empty when it is not set.
opportunity.body_querystring
The words the body must have. Empty when it is not set.
opportunity.title_body_joinstring
How title_query and body_query are combined: and or or. Empty when it is not set.

Example

Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "campaigns_saved_opportunity_update",
    "arguments": {
      "campaign": 124,
      "opportunity": 12,
      "label": "Media kits naming boutique hotels",
      "search": "opportunity_type",
      "opportunity_type": "advertising/advertise-with-us",
      "type_score_min": 40,
      "similarity_target": "campaign",
      "similarity_score_min": 25,
      "title_query": "\"media kit\" OR advertise",
      "pr_domain_min": 20
    }
  }
}

Response

The response is shown in full.

{
  "opportunity": {
    "id": 12,
    "label": "Media kits naming boutique hotels",
    "state": "active",
    "search": "opportunity_type",
    "opportunity_type": "advertising/advertise-with-us",
    "content_type": "",
    "filters": {
      "type_score_min": 40,
      "similarity_score_min": 25,
      "pr_domain_min": 20,
      "pr_domain_max": 80,
      "pr_host_min": 10,
      "pr_host_max": 90,
      "prot_domain_min": 5,
      "prot_domain_max": 95,
      "prot_host_min": 5,
      "prot_host_max": 95,
      "link_counts_min": {
        "article": {
          "follow": 2,
          "nofollow": 1,
          "sponsored": 0,
          "ugc": 0
        },
        "nav": {
          "follow": 1,
          "nofollow": 0,
          "sponsored": 0,
          "ugc": 0
        },
        "comments": {
          "follow": 0,
          "nofollow": 1,
          "sponsored": 0,
          "ugc": 0
        }
      }
    },
    "similarity_target": "campaign",
    "similarity_text": "",
    "vector_ready": false,
    "title_query": "\"media kit\" OR advertise",
    "body_query": "",
    "title_body_join": ""
  }
}

The example call and the example answer are the contract samples, copied as they are. The answer shows every key of a saved opportunity, so it has values that the call did not send.

Errors

An error returns as a tool result with isError true. Its text starts with the error code. An example: a call by a team member who cannot make this change.

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "no_access: You have read permissions for this campaign."
      }
    ],
    "isError": true
  }
}

One error is not a tool result. A call with a token that does not have the scope api:write gets the HTTP status 403, as the MCP standard says. The answer has a WWW-Authenticate header with error="insufficient_scope" and the scopes that the call needs. An MCP app that reads this header asks you for the permissions to change campaigns. The body has the error code forbidden and its sentence. The tool does not run, and the call is not counted.

HTTP/1.1 403 Forbidden
WWW-Authenticate: Bearer error="insufficient_scope", scope="mcp:use api:write", resource_metadata="https://mcp.oppalerts.com/.well-known/oauth-protected-resource/mcp", error_description="This token cannot change data. Make a new API token with edit permissions on the API tokens page, or connect the app again and allow changes."
Content-Type: application/json

{
  "error": "forbidden",
  "error_description": "This token cannot change data. Make a new API token with edit permissions on the API tokens page, or connect the app again and allow changes."
}

The error codes of this tool, each with its HTTP status and its sentence:

  • bad_param (HTTP 400 in the API): A parameter is missing, unknown, or has a wrong value. The sentence names it.
  • no_campaign (HTTP 404 in the API): That campaign is not in this account.
  • forbidden (HTTP 403 in the API, and HTTP 403 in MCP too, see above): This token cannot change data. Make a new API token with edit permissions on the API tokens page, or connect the app again and allow changes.
  • no_access (HTTP 403 in the API): You have read permissions for this campaign.
  • db_error (HTTP 500 in the API): The change could not be saved. Nothing was changed.
  • missing_field (HTTP 400 in the API): label is empty: send the name of the saved opportunity.
  • bad_search (HTTP 400 in the API): search, opportunity_type, or content_type does not name a search or a type that exists. The sentence names the field.
  • similarity_text_words (HTTP 400 in the API): similarity_text has more than 1,000 words: shorten it.
  • type_limit (HTTP 409 in the API): Not saved: this campaign already has the most active opportunity types its plan allows. Archive a type before adding another.
  • label_taken (HTTP 409 in the API): This campaign already has an opportunity with that label.
  • similarity_text_too_long (HTTP 400 in the API): Not saved: the similarity text is too long to use in a search. Shorten it and save again.
  • embed_failed (HTTP 502 in the API): Not saved: the similarity text could not be prepared for searching now. Nothing was changed. Try again in a few minutes.
  • opportunity_not_found (HTTP 404 in the API): That opportunity is not in this campaign.
  • similarity_text_empty (HTTP 400 in the API): similarity_target is similarity_text, and similarity_text is not sent or holds only spaces. Send the text, or choose another similarity_target.
  • nothing_to_search (HTTP 400 in the API): similarity_target is none and there is no title_query and no body_query: a saved opportunity needs a vector, words, or both.
  • query_no_term (HTTP 400 in the API): title_query or body_query holds no search term, such as only spaces, or only characters that are not letters or digits. The sentence names the field. Send at least one word or a phrase in quotes, or leave the field out.
  • query_too_many_terms (HTTP 400 in the API): title_query or body_query holds more than 20 words or phrases. The sentence names the field and the limit. Send 20 or fewer: nothing is cut.
  • query_operator (HTTP 400 in the API): title_query or body_query has a formatting error: a character that is not a letter, a digit, a space, or a search operator, or a search operator in a wrong place, for example parentheses inside parentheses, OR with no word on one side, or only words with - before them. The sentence names the field, says that the query has a formatting error, and says what the error is. The query is not saved.
  • min_above_max (HTTP 400 in the API): A PR or PRoT minimum is above its maximum, for example pr_domain_min above pr_domain_max. The sentence names the 2 fields.
  • rank_out_of_range (HTTP 400 in the API): A PR field is outside its range (a minimum 0 to 100, a maximum 1 to 100), or a PRoT field is outside its range (a minimum 0 to 1000000, a maximum 1 to 1000000). The sentence names the field and its range.

Limits

  • This tool has its own daily count for the account. When the count is used up, the call is refused with daily_limit (HTTP 429 in the API). account_calls_left shows the calls left today and when the count resets.
  • A refused call does not use the daily count of this tool.
  • This tool is not an index search. It does not use the daily count of index searches.
  • Only one change runs at a time per account. A call made while another change is running for the account is refused with one_at_a_time (HTTP 429 in the API) and uses no daily call. Send it again after a few seconds.
  • similarity_text: at most 1,000 words and at most 20,000 characters.
  • title_query and body_query: at most 500 characters each. At most 20 words or phrases each. A text with more is refused with query_too_many_terms, and nothing is cut.
  • The plan sets how many opportunity types can be active in a campaign (type_limit).

Same change in the API

POST /v1/campaigns/saved_opportunity_update HTTP/1.1
Host: api.oppalerts.com
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{"campaign": 124, "opportunity": 12, "label": "Media kits naming boutique hotels", "search": "opportunity_type", "opportunity_type": "advertising/advertise-with-us", "type_score_min": 40, "similarity_target": "campaign", "similarity_score_min": 25, "title_query": "\"media kit\" OR advertise", "pr_domain_min": 20}

The API page is POST /v1/campaigns/saved_opportunity_update.