Skip to content

Get account

/accounts

Target audience: Developers

Release version: 3.9.1

Get account

Introduction

This endpoint returns an account.
Included in the response is information regarding the account and it's subscriptions. However, if you want to perform an access check to see what the customer is entitled to we recommend using Get active products.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/accounts
Production https://backend.worldoftulo.com/external/api/v1/accounts

Requirements

Identity Scope
No /external/account/w

Parameters

Name Required Type Description
id Optional String The id of the account to get information about.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
email Optional String The email of the account to get information about. Must be URL-encoded.
Size range: ..1024
Allowed values:
"/\A[\w+-.]+@[a-z\d-]+(.[a-z]+)*.[a-z]+\z/i"
social_security_number Optional String The account's social security number. If this parameter is used it's value must be unique, must be supplied unless customer_number is provided.
Allowed values: "dddddd-dddd"
customer_number Optional String The customer number for the account candidate. If this parameter is used it's value must be unique, must be supplied unless social_security_number is provided.
Size range: ..10
Allowed values: "/^[a-zA-Z-_0-9]+$/"
external_id_key Optional String The external id key of the account that should be fetched. Must be accompanied by external_id_value.
external_id_value Optional String The external id value of the account that should be fetched. Must be accompanied by external_id_key.

Curl Example

Email

curl --request GET \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/accounts?email=test%40example.com \
  --header 'accept: application/json' \
  --header 'authorization: Bearer <token>'

Customer number

curl --request GET \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/accounts?customer_number=0701234567 \
  --header 'accept: application/json' \
  --header 'authorization: Bearer <token>'

Response

Example response

HTTP 200
{
    "item": {
        "id": "585a4768edce2c5e6f000001",
        "email": "user@email.com",
        "status": "created",
        "verified": false,
        "customer_number": "12345",
        "first_name": "Kalle",
        "last_name": "Anka",
        "mobile_phone_number": "50460531",
        "social_security_number": "800610-8230",
        "social_security_number_century": "198006108230",
        "age": 40,
        "gender": "M", 
        //gender available only when the social security number is known
        "company_registration_number": null,
        "company_name", null,
        "alias": "Kalle123",
        "address": {
            "first_name": "Kalle",
            "last_name": "Anka",
            "street": "The Streets",
            "street_number": "12",
            "staircase": "A",
            "floor": "3",
            "apartment_number": "13",
            "zip_code": "83242",
            "city": "Stockholm",
            "drop_box": null,
            "country_code": "SE"
        },
          "identity_mapping": [
              {
                "key": "Key 1",
                "value": "Value 1"
              },
              {
                "key": "Key 2",
                "value": "Value 2"
              }
          ],
        "user_products": [
            {
                "id": "585a4768edce2c5e6f000003",
                "created": "2016-12-21T10:12:08+01:00",
                "updated": "2016-12-21T10:12:08+01:00",
                "product_code": "package_code",
                "title_code": "TITLE_CODE",
                "valid_from": "2016-12-20T10:12:08+01:00",
                "valid_to": "2016-12-22T10:12:08+01:00",
                "provision_service": "tulo",
                "subscription_type": "recurring",
                "subscription_number": "12345",
                "state": "activated",
                "has_pending_change_request": false,
                "campaign_end_date": null,
                "subscription_end_date": "2016-12-22T10:12:08+01:00",
                "external_start_date": "2016-12-20T10:12:08+01:00" 
                //external_start_date available only for Kayak provisioned subscriptions
            }
        ],
        "accepted_marketing_permissions": [
            {
                "id": "5ba4a64509c04c5ab4000001",
                "type": "sms"
            }
        ]
    }
}

Errors

Example error response

HTTP 400 Bad Request
{
  "code": "invalid_parameter",
  "field": "social_security_number",
  "message": "Parameter must match format (/^[0-9]{6}-[0-9]{4}$/)"
}

HTTP 400 Bad Request

Name Type Description
unknown_parameter Object One or more of the fields in the posted json was not recognized

HTTP 404 Not Found

Name Type Description
not_found Object The account could not be found

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side