Guides
API principles

Errors

The two error schemas of the Marketing API, the most common validation codes, the authentication, version and Rest.li errors and Mimicr's 501.

The Marketing API has two error schemas. Accounts, account users, groups, campaigns and creatives use the new schema, with a code and per-field details; the other resources use the old one, with only status, serviceErrorCode and message.

New schema

json
{
  "status": 400,
  "serviceErrorCode": 10007,
  "code": "FIELD_VALUE_TOO_LOW",
  "message": "/Campaign/dailyBudget/amount value 5.0 can't be lower than 50.00",
  "errorDetailType": "com.linkedin.common.error.BadRequest",
  "errorDetails": {
    "inputErrors": [
      {
        "code": "FIELD_VALUE_TOO_LOW",
        "description": "/Campaign/dailyBudget/amount value 5.0 can't be lower than 50.00",
        "input": { "inputPath": { "fieldPath": "/Campaign/dailyBudget/amount" }, "value": { "decimalValue": "5.0" } },
        "minValue": "50.00"
      }
    ]
  }
}

With more than one error, code is MULTIPLE_VALIDATIONS_FAILED, the message is "Multiple errors occurred during the input validation. Please see errorDetails for more information." and each error comes in errorDetails.inputErrors. Cross-field errors come in conditionalInputErrors. fieldPath starts with /Account/, /CampaignGroup/, /Campaign/ or /Creative/; targeting facets use parameterPath.

Old schema

json
{ "status": 400, "serviceErrorCode": 100, "message": "At least one of the following facets must be provided: accounts, campaignGroups, campaigns, creatives, shares, companies" }

Some old-schema errors carry a code: VERSION_MISSING, NONEXISTENT_VERSION, ACCESS_DENIED, USER_NOT_AUTHORIZED, TOO_MANY_REQUESTS.

Common validation codes

CodeWhen
MISSING_FIELDA required field is missing (locale, targetingCriteria, dailyBudget/totalBudget…)
CONDITIONAL_MISSING_FIELDA field another one requires is missing (runSchedule.end with totalBudget)
FIELD_VALUE_TOO_LOW, FIELD_VALUE_TOO_HIGHBelow a budget or bid minimum; over an entity limit
CURRENCY_MISMATCHCurrency other than the account's
INVALID_CAMPAIGN_CONFIGURATIONObjective, format, type, optimization target and cost type don't fit
STATUS_CHANGE_NOT_ALLOWED, INVALID_STATUS_TRANSITIONStatus change not allowed
FIELD_NOT_ALLOWED, IMMUTABLE_FIELDRead-only or immutable field, or a field of a newer version
AUDIENCE_SIZE_TOO_SMALLActivating with an audience under 300
CTA_REQUIRED_FOR_LEAD_GENLead generation creative without leadgenCallToAction
DELETE_NOT_ALLOWED, DELETE_ALLOWED_ONLY_FOR_DRAFT_STATUSDeleting something that isn't DRAFT
TEST_ACCOUNT_LIMIT_REACHEDSecond test account of the app

Messages follow LinkedIn's templates, with the values filled in. The reference of each route lists its errors.

Authentication, permission, version and protocol

HTTPBodyCause
400VERSION_MISSINGNo LinkedIn-Version
400"Invalid query parameters passed to request"2.0 syntax without X-Restli-Protocol-Version, or an unencoded URN
400"Invalid request: missing X-RestLi-Method header for partial update"POST to a key without X-RestLi-Method
401"Empty oauth2_access_token"No token
40165600 INVALID_ACCESS_TOKEN, 65601 REVOKED_ACCESS_TOKEN, 65602 EXPIRED_ACCESS_TOKENInvalid, revoked or expired token
403ACCESS_DENIEDMissing scope
403NO_PERMISSION_ON_ENTITYRole too low, or an account outside the development tier's list
404NOT_FOUNDDoesn't exist, or an account the member has no role on
426NONEXISTENT_VERSIONSunset, unknown or unreleased version
429TOO_MANY_REQUESTSDaily quota reached (see Rate limits)

OAuth errors are different: {"error": "invalid_request", "error_description": "…"} (see Authentication). The Conversions API answers 422 {"status": 422, "message": "ERROR :: /conversionHappenedAt :: …"} on schema errors and 400 "Validation failed because […]" on data errors (see Conversions API). Lead Sync uses 401 instead of 403 for missing permission on leads and forms.

Server errors and out of scope

HTTPcodeWhen
408TIMEOUTanalytics chaos
409CONFLICT "Write Conflict"api chaos: concurrent update
500INTERNAL_ERRORChaos, or the [falha-simulada] trigger
501NOT_IMPLEMENTEDRoute or feature outside Mimicr's core
503UNDER_MAINTENANCEapi chaos
504"Gateway Timeout"api chaos
json
{ "status": 501, "serviceErrorCode": 0, "code": "NOT_IMPLEMENTED", "message": "Not simulated by Mimicr: GET /rest/dmpSegments is outside the integration core." }

Chaos with apiErrorWhen: after processes the write and answers 500: the "created but reported failed" case. Since creates aren't idempotent, search before retrying.