1. Home
  2. Documenti
  3. English
  4. Getting Started
  5. API

API

With Portrait platform it is possible to create a Psychometric Profiling API key to facilitate the integration of the technology with other systems.

NB: API tokens allow third-party services to authenticate with our application on your behalf.

To start creating the Psychometric Profiling API key follow the procedure described in the series of images below.

First click on the API menu item as shown in the figure below:

portrait profiling API key configurator

In the window that opens you will be able to create your API integration key with Portrait technology.

NB: A default token is automatically created by the platform, as shown in the figure:

portrait profiling default API key

Start by writing a meaningful API token name that will remind you which system you are integrating psychometric profiling into:

how to create portrait profiling API key

Click on the “create” button as shown in the figure to begin configuring the API key:

click on the button create to save your API key

At this point your named key will be added at the bottom, as shown in the figure below:

portrait profiling API key

Use the “copy” button to copy your token number and integrate it into your preferred system.

Use the trash icon to permanently remove the key.

NB: Delete all your existing API tokens if they are no longer needed.

HOW TO MAKE AN API REQUEST

curl --location 'https://app.portrait-profiling.ai/api/profile' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: pa_*******' \
--data '{
  "text": "I am a very good person",
  "llm_goal": "I would like to know if the user is prone to make online purchases",
  "llm_language": "en",
  "correlations_matrix_all": false,
  "correlations_matrix": []
}

AUTHENTICATION

In order to authenticate you need to pass the X-API-Key header with the value of one of the tokens that have been generated.
For more information on how to generate a token go to the top of this page.

PARAMETERS

text (string, required) – Text to parse
correlations_matrix_all (boolean, optional) – If true, all created correlation matrices are calculated. Default: false
correlations_matrix (array, optional) – Array containing the ids of the correlation matrices that must be calculated. If correlations_matrix_all is true, this parameter is ignored.
llm_goal: (string, optional) – Text that represents the profiling goal to pass to the LLM.
llm_language: (string,optional) – Language of the text to be passed to the LLM for objective evaluation.Default: “en”, accepted: [it|en|fr|de|es]

ANSWER

{
  "profile": {
    "behav_decisionmaking": 0.001,
    "behav_impressionmanagement": 0.001,
    "behav_lifesatisfaction": 0.001,
    "behav_spendingattitude": 0.001,
    "net_transitivity": 0.001,
    "pers_adventurous": 0.001,
    "pers_agreeableness": 0.001,
    "pers_altruism": 0.001,
    "pers_anger": 0.001,
    "pers_anxiety": 0.001,
    "pers_art_interests": 0.001,
    "pers_assertiveness": 0.001,
    "pers_caution": 0.001,
    "pers_cheerfulness": 0.001,
    "pers_conscientiousness": 0.001,
    "pers_cooperativity": 0.001,
    "pers_creativity": 0.001,
    "pers_depression": 0.001,
    "pers_discipline": 0.001,
    "pers_efficacy": 0.001,
    "pers_emotion": 0.001,
    "pers_excitability": 0.001,
    "pers_extroversion": 0.001,
    "pers_friendlyness": 0.001,
    "pers_gregariousness": 0.001,
    "pers_immoderability": 0.001,
    "pers_intellectual": 0.001,
    "pers_liberal": 0.001,
    "pers_modesty": 0.001,
    "pers_morality": 0.001,
    "pers_neuroticism": 0.001,
    "pers_openness": 0.001,
    "pers_order": 0.001,
    "pers_proactivity": 0.001,
    "pers_selfcontrol": 0.001,
    "pers_sense_of_duty": 0.001,
    "pers_simpathy": 0.001,
    "pers_trust": 0.001,
    "pers_vulnerability": 0.001,
    "pers_will": 0.001,
    "values_achievement": 0.001,
    "values_benevolence": 0.001,
    "values_conformity": 0.001,
    "values_hedonism": 0.001,
    "values_power": 0.001,
    "values_security": 0.001,
    "values_self-direction": 0.001,
    "values_stimulation": 0.001,
    "values_tradition": 0.001,
    "values_universalism": 0.001
  },
  "aggregated_profile": {
    "Adv-LikesAlternativeCommunication":  0.5,
    "Adv-LikesLogicalCommunication":  0.5,
    "Adv-LikesTraditionalCommunication":  0.5,
    "Adv-LikesUpbeatCommunication":  0.5,
    "Attitude-Attractiveness":  0.5,
    "Attitude-Churn":  0.5,
    "Attitude-Dominance":  0.5,
    "Attitude-LoyalCustomer":  0.5,
    "Attitude-OpenToInnovation":  0.5,
    "Attitude-Passivity":  0.5,
    "Attitude-Prosocial":  0.5,
    "Attitude-Radicalization":  0.5,
    "Attitude-SelfTrascendence":  0.5,
    "Attitude-SensationSeeker":  0.5,
    "Attitude-ShareEmotionalPosts":  0.5,
    "Cognition-HighAttention":  0.5,
    "Cognition-Plasticity":  0.5,
    "Cognition-Stability":  0.5,
    "Credit-RepayDebt":  0.5,
    "Insurance-Coverage": 0.5,
    "Job-CareerSeeking":  0.5,
    "Job-DecisionMaking":  0.5,
    "Job-EffectiveLearnigStyle":  0.5,
    "Job-GroupTaskProficiency":  0.5,
    "Job-IndividualTaskProficiency":  0.5,
    "Job-NotManagingStress":  0.5,
    "Job-RelationalAbility":  0.5,
    "Purchase-Compulsivebuyer":  0.5,
    "Purchase-HighSpending":  0.5,
    "Purchase-Impulsivebuyer":  0.5,
    "PurchaseMotivation-SeekBelonging":  0.5,
    "PurchaseMotivation-SeekSelfEnhance":  0.5,
    "PurchaseMotivation-SeekStatusDisplay":  0.5,
    "Relationship-Anxiety":  0.5,
    "Relationship-Avoidance":  0.5,
    "Relationship-Quality":  0.5,
    "Wellbeing-HealthyStyle":  0.5,
    "Wellbeing-LifeSatisfaction":  0.5
  },
  "traffic_lights": [
    {
      "correlation_matrix_id": "uuid",
      "name": "traffic_lights",
      "switched_on": true
    }
  ],
  "goal_response": "risposta dell'LLM",
  "remaining_credits": 0
}

profile

profile returns all the information (all traits) about the profile analyzed by Portrait

aggregated_profile

aggregated_profile returns only information about the aggregated user traits analyzed by Portrait.

NB: only the most relevant fields for the generated profile are returned.

traffic_lights

Traffic_lights returns an array containing the requested traffic lights, they are always returned:

correlation_matrix_id (string) – id of the correlation matrix
name (string) – name of the traffic light
switched_on (boolean) – whether the traffic light is active
the API returns all the traffic lights created if the correlations_matrix_all parameter is true, otherwise it returns only those indicated in the correlations_matrix parameter.

goal_response

Goal_response returns the LLM’s response regarding the requested goal and the user profile generated by Portrait.

remaining_credits

remaining_credits returns the number of credits remaining in your Portrait account.

EXAMPLE OF USE OF APIs

In this example we see how to use the Portrait API to improve communication with your users by connecting a chatbot.

In this way, the chatbot will be able to detect the psychometric traits of the interlocutor, to highlight the risk of churn, the propensity to purchase, up-selling, cross-selling, the predilection for logical vs. creative messages, etc. and to adapt communication accordingly.

Click here to access the documentation of our chatbot creation platform crafter.ai to get an overview of the integration of Portrait technology within a conversational AI solution.