User Activity Credit

Request Details

Item Value
Description This endpoint attempts to award the user points for the given Activity. Due to frequency capping limits and other factors, points may not actually be awarded if the user is not able to earn them at the time of the request. Also note that Activity awards are queued up; this response indicates that we will process the request to award points, generally within seconds.
Method POST
Endpoint https://[environment]api[client_id].crowdtwist.com/v2/users/[user_id]/activities?api_key=[api_key]&id_type=[id_type]
HTTP Header X-CT-Authorization = CTApiKey [API Key]
Note: There is a space between CTApiKey and the API Key value.
Content Type application/json

Request

Field Name Sample Value Required Format Description
URL PARAMETERS
user_id alice@crowdtwist.com Yes String Unique ID of the user for whom activities will be returned:
Options:
– Email Address
– Facebook User ID
– Twitter User ID
– CrowdTwist ID
– Third Party ID
– Username
– Mobile Phone Number
– Instagram Username
QUERY PARAMETERS
api_key QWERTYP Yes String
id_type email No String Type of ID being Sent:
Options:
– email
– facebook_user_id
– twitter_user_id
– id (CrowdTwist ID) – default ID if id_type is not specified
– third_party_id
– username
– mobile_phone_number
– inst_username


Request Body

Field Name Sample Value Required Format Description
activity_id 410052775 Yes String Internal CrowdTwist activity id.
activity_date 1523549197 No Integer The date when user plans to perform or has performed the activity.
Date in Epoch (UNIX) format.
Note: To enable this feature please contact your account team.
num_points 150 No Integer The number of points to award for completion of the activity. If used, this will override the default point value of the activity being credited.
extra_data See the EXTRA DATA OBJECT section. No Object An additional data field to add during the execution of an activity credit. If used, this will store along with the activity completion record and can be used in reporting.
EXTRA DATA OBJECT
Test Test No String Additional data as added.

Response

Response Body

Field Name Sample Value Required Format Description
awarded true Yes String A short, descriptive sentence detailing the status.


Error Responses

Field Name Sample Value Required Format Description
error Field value is empty. Yes String This is a short form of the error.
message Value of field [fieldname] must not be empty. Yes String This is a detailed message around the error specifying, as specifically as possible, what the fields are that are missing or where exactly the error is.


Error Response Codes

Error Error Code Description Reason
Input Error 4xx Returned whenever the request is missing required fields, including situations in which the body is malformed (e.g. HTTP method not supported, receipt not found, etc.). – missing_data
– not_unique
– receipt_not_found
– invalid_amount
– invalid_currency
– invalid_date
– invalid_custom_field
– invalid
Server Error 5xx HTTP error status code is returned due to an error that occurred in the backend. – internal_error: unexpected error occurred in the CrowdTwist backend
– missing_field
– invalid_data
– not_configured: error occurs when an configuration has not been configured yet



Example Response Codes

Response Code Error Message
404 page_not_found User does not exist.

Samples

Sample Request Body

curl -X POST 'https://api.crowdtwist.com/v2/users/alice@crowdtwist.com/activities?api_key=QWERTYUIOP&id_type=email'


Sample Request Body

{ "activity_id":"197", "num_points":100, "extra_data": { "coupon_numbers":"123|456|789" } }

 

Sample Response Body

{ "awarded": true }

 

Sample Error Response

{ "error": "page_not_found", "message": "User does not exist." }