Documentation / API / campaigns_organizations

campaigns_organizations

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

Lists the organizations of one campaign, each with its relationship, its hosts, its brand names, and its chart color.

What it does

The tool lists the organizations of one campaign: every organization of the campaign, with its relationship, its hosts, its brand names, and its chart color. The index tools use these relationship values to label result rows. campaign is required.

This tool only reads. The change tools campaigns_organization_add, campaigns_organization_update, and campaigns_organization_delete change the organizations.

Authentication

Send your token in the Authorization: Bearer header. The API overview explains how to get a token.

Parameters

campaignint, required, 1 to 4294967295
The campaign id, from campaigns_list. It must be a campaign of your account.

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." The old name of a renamed field is refused in the same way.
  • 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, or a value that is not in its list. A required field that you do not send is refused too. 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 has only its own sentence.

Response fields

organizationslist
One item for each organization of the campaign.
organizations[].idint
The organization id.
organizations[].relationshipstring
The relationship to the brand: org_owned_brand, org_competitor, org_partner, or org_publisher.
organizations[].hostslist of strings
The hosts of the organization.
organizations[].brand_nameslist of strings
The brand names of the organization.
organizations[].colorint, optional
The chart color of the organization, as a number. Left out when the organization has no color.
organizations[].color_hexstring, optional
The chart color of the organization, as a hex color, for example #1f77b4. Left out when the organization has no color.

Example

Request

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

Response

The response is shown in full.

{
  "organizations": [
    {
      "id": 9,
      "relationship": "org_owned_brand",
      "hosts": [
        "example-hotels.com",
        "example-hotels.co.uk"
      ],
      "brand_names": [
        "Example Hotels",
        "Example Hotel Group"
      ],
      "color": 3,
      "color_hex": "#1f77b4"
    }
  ]
}

Errors

  • bad_param (HTTP 400): a field is not a field of this tool, a required field is not sent, or a value has the wrong type or is out of its range. The error names the field.
  • no_campaign (HTTP 404): the campaign is not in this account
  • db_error (HTTP 500): the data could not be read
  • daily_limit (HTTP 429): the account has used all its calls for this tool today. account_calls_left shows when the count resets.

This tool has its own daily count. A call through the API or MCP uses one call from this count. A web app page reading the same data does not count. It is not an index search, so it does not use the shared count of the news_ and prospects_ tools, and the error one_at_a_time does not apply to it.

Same tool in MCP

The MCP tool is campaigns_organizations. See campaigns_organizations in MCP.