# Profiles
source: https://developer.mastercard.com/carbon-calculator/documentation/testing/testcase/test_case_engagement_profiles/index.md

Calculates the climate profile of the issuer based on survey answers.

## Pre-requisites {#pre-requisites}

Refer to the [Engagement Profiles](https://developer.mastercard.com/carbon-calculator/documentation/use-cases/engagement-services/profiles/index.md) use case.


API Reference: `POST /profiles`

<br />

## Test Cases {#test-cases}

### Test Case: Success-Update Climate Profile {#test-case-success-update-climate-profile}

##### Request {#request}

```json
{
  "surveyioResults": {
    "sex": "demo.f",
    "age": "demo.lt20",
    "country": "AX",
    "interest": "stronglyDisagree",
    "knowledge": "stronglyDisagree",
    "diet": "diet.vegan",
    "renewableElectricity": "energy.idk",
    "haveCar": "transport.noCar",
    "flyFrequency": "transport.secondMonth",
    "shopFrequency": "lifestyle.shopRarely",
    "difference": "stronglyDisagree",
    "consciousPurchasingDecision": "stronglyDisagree",
    "explainCarbonFootprint": "stronglyDisagree"
  }
}
```

##### Response {#response}

```json
{
  "profile": {
    "userAttributes": {
      "country": "AX",
      "demo": 34,
      "diet": 16399,
      "energy": 0,
      "lifestyle": 16,
      "transport": 20480
    },
    "benchmarks": {},
    "created": "2026-02-02T13:02:34Z",
    "persona": "5",
    "surveys": {
      "viewed": {
        "onboardingVersion": 1
      }
    },
    "traits": {
      "knowledge": 0.0,
      "lifestyle": 0.588,
      "motivated": 0.3
    }
  }
}
```

### Test Case: Fail-Invalid Request parameter {#test-case-fail-invalid-request-parameter}

##### Request {#request-1}

```json
{
      "surveyioResults": {
          "age": "demo.lt50",
          "country": "IN",
          "interest": "stronglyAgree",
          "knowledge": "stronglyAgree",
          "diet": "diet.vegan",
          "renewableElectricity": "energy.idk",
          "haveCar": "transport.noCar",
          "flyFrequency": "transport.never",
          "shopFrequency": "lifestyle.shopRarely",
          "difference": "stronglyAgree",
          "consciousPurchasingDecision": "stronglyDisagree",
          "explainCarbonFootprint": "stronglyDisagree"
      }
}
```

##### Response {#response-1}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "Carbon-Calculator",
        "ReasonCode": "INVALID_REQUEST_PARAMETER",
        "Description": "One of the request parameters is invalid, try again with correct request.",
        "Recoverable": false,
        "Details": "surveyioResults.sex must not be null"
      }
    ]
  }
}
```

### Test Case: Fail-Sending Invalid age, flyFrequency or diet parameter {#test-case-fail-sending-invalid-age-flyfrequency-or-diet-parameter}

##### Request {#request-2}

```json
{
      "surveyioResults": {
          "age": "<script>alert(1);</script>",
          "sex":"demo.f",
          "country": "GB",
          "interest": "stronglyAgree",
          "knowledge": "stronglyAgree",
          "diet": "<script>alert(1);</script>",
          "renewableElectricity": "energy.selfProduced",
          "haveCar": "transport.hasCar",
          "carFuel": "transport.petrol",
          "flyFrequency": "<script>alert(1);</script>",
          "shopFrequency": "lifestyle.shopVeryOften",
          "difference": "somewhatDisagree",
          "consciousPurchasingDecision": "somewhatAgree",
          "explainCarbonFootprint": "neutral"
    
    
      }
}
```

##### Response {#response-2}

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "Carbon-Calculator-Engagement-Services",
        "ReasonCode": "INVALID_REQUEST_PARAMETER",
        "Description": "One of the request parameters is invalid, try again with correct request.",
        "Recoverable": false,
        "Details": "surveyioResults.diet must be in valid format"
      },
      {
        "Source": "Carbon-Calculator-Engagement-Services",
        "ReasonCode": "INVALID_REQUEST_PARAMETER",
        "Description": "One of the request parameters is invalid, try again with correct request.",
        "Recoverable": false,
        "Details": "surveyioResults.flyFrequency must be in valid format"
      },
      {
        "Source": "Carbon-Calculator-Engagement-Services",
        "ReasonCode": "INVALID_REQUEST_PARAMETER",
        "Description": "One of the request parameters is invalid, try again with correct request.",
        "Recoverable": false,
        "Details": "surveyioResults.age must be in valid format"
      }
    ]
  }
}
```

