Skip to main content

Getting started with the Communities API

Use the Coolblue Closed Community Management API to onboard and offboard the members of your closed community and manage their credit. This guide takes you through the first call in Acceptance.

Before you start​

  • An agreement with Coolblue for a closed community.
  • Your community ID, which Coolblue sends you after setting up the community.
  • Acceptance credentials for the Communities API. See Authentication.
  • Access to Acceptance: Coolblue has to allowlist the IP addresses you call from. Send them to your Coolblue contact.

1. Get an access token​

The Communities API has its own token URL. Post the parameters in the request body:

TOKEN=$(curl -s -X POST "https://auth.chloe.cb-aws-acc.eu/oauth2/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=$CLIENT_ID" \
-d "client_secret=$CLIENT_SECRET" | jq -r .access_token)

2. Onboard a member​

curl -X POST "https://chloe.cb-aws-acc.eu/v2/communities/YOUR_COMMUNITY_ID/members" \
-H "Authorization: Bearer $TOKEN" \
-H "User-Agent: Coolblue-YourCompanyName" \
-H "Content-Type: application/json" \
-d '{
"Member": {
"EmailAddress": "member@example.com",
"FirstName": "Jane",
"LastName": "Doe",
"ExternalReference": "HR-123456"
},
"Credits": [{ "Credit": 750.00 }]
}'

A 201 Created response means the member's Coolblue account is linked to the community, and the credit is added. If the email address already has a Coolblue account, that account is linked; otherwise a new account is created.

Field names are PascalCase

The Communities API uses PascalCase JSON properties (EmailAddress, FirstName), unlike the other APIs.

Common pitfalls​

  • Using a Production community ID in Acceptance, or the other way around.
  • Calling Acceptance from an IP address that is not allowlisted.
  • Sending a credit mutation without CategoryId when the community has several credit categories: you get 422.
  • Using the endpoints under Legacy in the reference. Use the /v2 endpoints instead.

Next steps​