Documentation / API / campaigns_saved_opportunity_activate

campaigns_saved_opportunity_activate

POSThttps://api.oppalerts.com/v1/campaigns/saved_opportunity_activate

Makes an archived saved opportunity active again.

What it does

The tool makes an archived saved opportunity active again. It is then counted every day and is in the daily opportunities email again.

An opportunity type counts against the plan's limit of active opportunity types per campaign. On the free plan, a campaign can have a maximum of 7 active saved opportunities, and each active brand search counts against this limit. 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 needs the scope api:write, and api:read as every API route does. Without api:write, the call gets the error forbidden. Authentication says which tokens have it.

Authentication

Send your token in the Authorization: Bearer header. The API overview explains how to get a token. The API also accepts the same call at POST /v1/campaigns_saved_opportunity_activate.

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.

Rules

Strict Rules

  • A field that is not in the list above is refused. The answer is HTTP 400 with the error code 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

Request

curl -X POST https://api.oppalerts.com/v1/campaigns/saved_opportunity_activate \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "campaign": 124,
  "opportunity": 12
}'

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": ""
  }
}

Errors

An error has an HTTP status and a JSON body with error, the error code, and error_description, the message. An example: a call with a token that does not have the scope api:write. This answer also has a WWW-Authenticate header with error="insufficient_scope" and the scopes that the call needs.

HTTP/1.1 403 Forbidden
WWW-Authenticate: Bearer error="insufficient_scope", scope="api:read api:write", resource_metadata="https://api.oppalerts.com/.well-known/oauth-protected-resource/v1", 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): A parameter is missing or has a wrong value. The sentence names it.
  • no_campaign (HTTP 404): That campaign is not in this account.
  • forbidden (HTTP 403): 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): You have read permissions for this campaign.
  • db_error (HTTP 500): The change could not be saved. Nothing was changed.
  • opportunity_not_found (HTTP 404): That opportunity is not in this campaign.
  • type_limit (HTTP 409): Not saved: this campaign already has the most active opportunity types its plan allows. Archive a type before adding another.
  • active_opportunity_limit (HTTP 409): Not saved: this campaign has the most active saved opportunities that its plan allows: 7 on the free plan, 25 on the other plans. The sentence gives the number. Archive one before you add or activate another.

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). 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) and uses no daily call. Send it again after a few seconds.
  • The plan sets how many opportunity types can be active in a campaign (type_limit).
  • A campaign can have at most 7 active saved opportunities on the free plan, and 25 on the other plans (active_opportunity_limit).

Same tool in MCP

The MCP tool is campaigns_saved_opportunity_activate. See campaigns_saved_opportunity_activate in MCP.