Account

This is an object representing your Previsto account. You can retrieve it to see properties on the account like its current e-mail address etc. You are allowed to change parameters for your own account only.

The account object also holds information about the user's authorizations in the property 'roles'. There are 2 kinds of roles: (1) system-wide roles and (2) organization-specific roles. System-wide roles are prefixed with ROLE_ and organization-specific roles are prefixed with ORGROLE_followed by the id of the specific organization.

The account object

Example Response

{
    "id": "acct-7B10MYfEnPp6r",
    "login": "john",
    "name": "John Dow",
    "email": "john@doe.com",
    "emailValidated": true,
    "address": "Kundevej 2",
    "appartment": null,
    "postalCode": "4321",
    "city": "Kundeby",
    "countryCode": "DK",
    "location": [11.543540954589844, 56.703469017862034],
    "languageCode": "da",
    "roles": [
        "ROLE_USER",
        "ORGROLE_org-ZW46jOjfA0rpDZ_USER"
    ],
    "meta": {
        "hairColor": "Brown"
    }
}

Properties

  • Name
    login
    Type
    string
    Required
    required
    Description
    -
  • Name
    name
    Type
    string
    Required
    required
    Description
    Full name of user
  • Name
    email
    Type
    string
    Required
    required
    Description
    Must have email syntax, fx. 'john@doe.com'
  • Name
    emailValidated
    Type
    boolean
    Description
    -
  • Name
    languageCode
    Type
    string
    Required
    required
    Description
    2-letter ISO 639-1 code, fx. 'da'
  • Name
    address
    Type
    string
    Description
    Street and house number
  • Name
    appartment
    Type
    string
    Description
    Apartment, fx. '1. th.'
  • Name
    postalCode
    Type
    string
    Description
    -
  • Name
    city
    Type
    string
    Description
    -
  • Name
    countryCode
    Type
    string
    Description
    2-letter ISO 3166-1 code, fx. 'DK'
  • Name
    location
    Type
    number\[\]
    Description
    Array of 2 numbers holding longitude and latitude in specified order according to geojson syntax. (Fx. [11.543540954589844, 56.703469017862034]). Will be resolved by the system from the specified address.
  • Name
    roles
    Type
    array
    Description
    Array of user's system and organization roles.
  • Name
    meta
    Type
    object
    Description
    Dictionary of meta values.

GET/accounts/current

Retrieve current account

This endpoint allows you to retrieve the currently authenticated account.

Request

GET
/accounts/current
curl -G https://api.previsto.com/accounts/current \
  -u sk_12345

Response

{
    "id": "acct-7B10MYfEnPp6r",
    "login": "john",
    "name": "John Dow",
    "email": "john@doe.com",
    "emailValidated": true,
    "address": "Kundevej 2",
    "postalCode": "4321",
    "city": "Kundeby",
    "countryCode": "DK",
    "location": [11.543540954589844, 56.703469017862034],
    "languageCode": "da",
    "roles": [
        "ROLE_USER",
        "ORGROLE_org-ZW46jOjfA0rpDZ_USER"
    ],
    "meta": {
        "hairColor": "Brown"
    }
}

Update current account

This endpoint allows you to perform an update the currently authenticated account.

Request

PUT
/accounts/current
curl -X PUT https://api.previsto.io/accounts/current \
  -u sk_12345 \
  -d email="jane@doe.dk"

Response

{
    "id": "acct-7B10MYfEnPp6r",
    "login": "john",
    "name": "John Dow",
    "email": "jane@doe.com",
    "emailValidated": true,
    "address": "Kundevej 2",
    "postalCode": "4321",
    "city": "Kundeby",
    "countryCode": "DK",
    "location": [11.543540954589844, 56.703469017862034],
    "languageCode": "da",
    "roles": [
        "ROLE_USER",
        "ORGROLE_org-ZW46jOjfA0rpDZ_USER"
    ],
    "meta": {
        "hairColor": "Brown"
    }
}