Skip to content
campaiDeveloper
campai.com

Donation · Campaigns

POST/{organizationId}/{mandateId}/donation/campaigns/createCampaign

Create donation campaign

Creates a donation campaign for a mandate using the supplied campaign details and optional cost centers. The cost centers are used for postings of booked donations to the campaign. Returns the new campaign’s _id.

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Who may call it

  • The caller must have organization access.
  • The caller needs mandate.read and donationsSettings.edit permissions.

Request

Path parameters

  • organizationIdidrequired
  • mandateIdidrequired

Body

Content-Type: application/json

  • namestringrequired

    1–100 characters

  • descriptionstringrequired

    at most 1000 characters

  • availablebooleanrequired
  • goalintegerrequirednullable

    at most 9999999999

  • costCenter1numberrequirednullable

    1–99999999

  • costCenter2numberrequirednullable

    1–99999999

Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/donation/campaigns/createCampaign' \
  --header 'X-API-Key: YOUR_API_KEY'

No request that worked has been recorded yet, so the body is not shown.

Response

200 Successful response

Content-Type: application/json

  • _idid
Response200
{
  "_id": "000000000000000000000001"
}

What else happens

  • Creates a record in donationCampaigns.

Errors

Other errors

StatusErrorWhen
400Cost centers are not available for this productIf a cost center is provided for a product that does not support cost centers, the endpoint returns 400 BAD_REQUEST with key finance.accounting.validateGetCostCenters.notSupportedByProduct. Only region us
400The Cost-center 1 first digit has to be within "regions digits"If regions are in use and the first digit of costCenter1 does not match a region, the endpoint returns 400 BAD_REQUEST with key finance.accounting.validateGetCostCenters.costCenter1Digits. Only region eu
400cost center name "cost center number" is invalidIf a cost center being validated is not found, the endpoint returns 400 BAD_REQUEST with key finance.accounting.validateGetCostCenters.invalidCostCenter. costCenter1 may instead be just a region digit. Only region eu
400cost center name "cost center number" is not bookableIf a cost center being validated is not bookable, the endpoint returns 400 BAD_REQUEST with key finance.accounting.validateGetCostCenters.notBookableCostCenter. Only region eu
404A mandate needs to be providedIf the mandate ID is a null object ID, the endpoint returns 404 NOT_FOUND with key organization.getMandate.nullMandateId.
404Mandate mandate ID not foundIf the mandate is not found in the organization, the endpoint returns 404 NOT_FOUND with key organization.getMandate.notFound.
404Accounting plan is missing. Please make sure you have setup your finances app properly.If costCenter1 is provided but the accounting plan is missing, the endpoint returns 404 NOT_FOUND with key finance.accounting.getAccountingPlan.notFound.

Marked words such as mandate ID are filled in with the actual value when the error happens.

Errors nearly every request can meet are listed under Errors.