Skip to Content
APIEndpointsUpdate competitor

Update competitor

Edits a tracked competitor. Every field is optional: omit one and it is left alone. Send only what you are changing.

Requires the write:competitors scope, and the workspace must be enabled for API writes.

PATCH /v1/brands/{brand_id}/competitors/{competitor_id}

Authorization

HeaderTypeRequired
AuthorizationBearer asky_sk_…required
Idempotency-Keystringrequired

Path parameters

ParameterTypeRequiredDescription
brand_iduuidrequiredFrom List brands
competitor_iduuidrequiredFrom List competitors

Query parameters

None.

Any parameter you pass returns 400 invalid_request naming the offending key.

Body

application/json. At least one field is required.

FieldTypeRequiredDescription
namestring, 1–200 charsoptional
primary_urlstring, up to 2048 charsoptionalhttp or https, pointing at a domain. Cannot be cleared
aliasesstring[], up to 50optionalReplaces the existing aliases outright. Send the full list
relationstringoptionalOne of direct_competitor, indirect_competitor, partner
is_activebooleanoptionalSet false to stop tracking without losing history
match_case_sensitivebooleanoptional
match_require_domainbooleanoptional

Request

curl --request PATCH \ --url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/competitors/c4a7e1b2-38d9-4f60-b5ac-2d90e7f14b83' \ --header 'Authorization: Bearer <api-key>' \ --header 'Idempotency-Key: <unique-per-attempt>' \ --header 'Content-Type: application/json' \ --data '{"relation":"indirect_competitor","aliases":["Try Profound","Profound AI"]}'

Response

{ "data": { "competitor": { "id": "c4a7e1b2-38d9-4f60-b5ac-2d90e7f14b83", "name": "Profound", "primary_url": "https://tryprofound.com", "domain": "tryprofound.com", "relation": "indirect_competitor", "aliases": ["Try Profound", "Profound AI"], "is_active": true, "is_manual": true, "match_case_sensitive": false, "match_require_domain": false, "match_mode": "apex" } }, "request_id": "req_8a03c7de51b94f26d1ac" }

Response fields

Identical to Create competitor. The full competitor is returned, read back after the write, not just the fields you changed.

Errors

StatusCodeWhen
400invalid_requestUnknown field, no fields at all, a URL that is not http/https or does not point at a domain, an unknown relation, or more than 50 aliases
401invalid_tokenThe key is missing, malformed, or does not exist
403insufficient_scopeThe key does not carry write:competitors
403plan_requiredThis workspace is not enabled for API writes
404not_foundThe brand or competitor does not exist, or this key is not allowed to reach it
429rate_limitedOver 60 requests per minute

Notes

aliases replaces, it does not merge. Send the aliases you want the competitor to end up with. Sending [] removes them all. Read the current list from Get competitor first if you are adding to it.

primary_url cannot be cleared. There is no null for it here: a manually added competitor is required to have one, and every competitor this API can create is manually added.

Changing primary_url moves attribution. domain is re-derived on every URL change, so citations attributed to the old domain stop counting and the new domain starts. Read the returned domain to confirm what the competitor now claims. A null means another competitor on this brand already holds that domain.

Deactivating is not deleting, and deactivating is usually what you want. is_active: false stops the competitor being tracked going forward and keeps all of its history, so your past visibility and share-of-voice numbers stay comparable.

There is no delete endpoint yet. Deleting a competitor removes every measurement ever recorded against it, which for an established competitor is tens of thousands of rows, and it changes historical share of voice for the others, since share is relative. We would rather ship that with a way to preview the damage first than without one, so it is not here yet. Deactivate instead unless you genuinely want the history gone.

Idempotency-Key is required. Reuse it when retrying an attempt and the original response is replayed rather than the write happening twice. See Idempotency.

Last updated on