Back to top

User and Identity

User and Identity bounded context aka User&Identity.

JSON Web Token

User&Identity uses for authentication JWT:

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed.

Special roles

User&Identity uses special roles to protec specific end-points, for example to create invitation or fetch user information.

Role Description
uai_admin Can create invitations, prototype users. Enable/disable users. Read Users.
uai_user_manager Can create and manage users. Only internal users will be created.
uai_invitation_manager Can create invitations.

Sample journies

Invite a user:

Create a prototype user, create an invitation to him and redeem the invitation.

  1. POST /user-prototypes

  2. POST /user-prototypes/{id}/invitations

  3. PUT /invitations/{id}/redemption

Login:

Login to retrieve a token, verify token and refresh for a new one.

  1. POST /authentications

  2. GET /me

  3. POST /authentications/me/refresh

Login using google Oauth:

  1. GET /authentications/google?redirect_uri=http://bff.spotahome.com/google/check&state=aabbccdd45nnaa

  2. Authenticate inside google using the authorization URL from the step 1.

  3. POST authentications/google with the authorization code, redirect_uri and state.

Disable and enable a user:

  1. DELETE /users/{id}/enabling

  2. PUT /users/{id}/enabling

Update user’s email and information by an admin:

  1. PUT /admin/users/{id}/email

  2. PUT /admin/users/{id}/information

Update user’s email by the user himself:

  1. POST /me/email-change

  2. PUT /email/verification/{checksum}

Update user’s information by the user himself:

  1. PUT /me/information

Forget password

Request a new password, get the link and set the new password

  1. POST /forgotten-passwords

  2. GET /forgotten-passwords/{id}

  3. PUT /forgotten-passwords/{id}/password

Create user with password account

Create a user with password, get the link and activate the account.

  1. POST /signup

  2. GET /users/activation/{id}

  3. POST /authentications

Invitations

Invitation

Get invitation
GET/invitations/{id}

Authorization: protected for uai_admin roles.

Example URI

GET https://user-identity.spotahome.com/invitations/68a5sdf67
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The invitation ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "id": "68a5sdf67",
    "userId": "98uhy65rf",
    "createdAt": "2004-02-12T15:20:18+00:00",
    "isRedeemed": true,
    "redeemedAt": "2004-02-12T15:20:21+00:00",
    "emailSentAt": "2004-02-12T15:19:21+00:00",
    "isEmailSent": true,
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Reedem invitation

Redeem invitation
PUT/invitations/{id}/redemption

Redeem the invitation to finish the creation of a user.

Example URI

PUT https://user-identity.spotahome.com/invitations/68a5sdf67/redemption
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The invitation ID

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "password": "123456"
}
Response  204
HideShow
Headers
Content-Type: application/json
Location: /users/as4fgt56
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Prototype Users

Prototype users

Allow to create new prototype user, with no password, so this user can not log in until configure his password.

Authorization: protected for uai_admin role.

Create prototype user
POST/user-prototypes

Example URI

POST https://user-identity.spotahome.com/user-prototypes
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "fullname": "John Smith",
  "email": "user@domain.com",
  "locale": "es_ES",
  "roles": [
    "foo",
    "bar"
  ]
}
Response  201
HideShow
Headers
Location: /users/123abc
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Invitations

Create invitation
POST/user-prototypes/{id}/invitations

Invitation for the prototype user, allows to finish the creation of the user account establishing the password.

Authorization: protected for uai_admin, uai_user_manager and uai_invitation_manager roles.

Example URI

POST https://user-identity.spotahome.com/user-prototypes/68a5sdf67/invitations
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
    "notify" : true, //default value
    "callback_url" : "http://spotahome.com/bff/landlord/invitation/:id"
}
Response  201
HideShow
Headers
Location: /invitations/123abc
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Users

Users

Authorization: protected for uai_admin

Search users
GET/users{role,email,ids,page,itemsPerPage}

Example URI

GET https://user-identity.spotahome.com/usersuai_admin&test@spotahome.com&aaaa&0&10
URI Parameters
HideShow
role
string (optional) Example: uai_admin
email
string (optional) Example: test@spotahome.com
ids
string (required) Example: aaaa

bbbb-cccc, cccc-aaaa-bbbb (array[string], optional) - Criteria by multiple ids.

page
number (optional) Example: 0
itemsPerPage
number (optional) Example: 10
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "count": 1,
  "total": 2,
  "_links": {
    "self": {
      "href": "users?role=uai_admin&itemsPerPage=1&page=1"
    },
    "first": {
      "href": "users?role=uai_admin&itemsPerPage=1&page=1"
    },
    "last": {
      "href": "users?role=uai_admin&itemsPerPage=1&page=2"
    },
    "next": {
      "href": "users?role=uai_admin&itemsPerPage=1&page=2"
    }
  },
  "_embedded": {
    "users": [
      {
        "id": "5fae5dd4-f575-4461-bda1-d7c9b0227e53",
        "email": "fake@spotahome.com",
        "roles": [
          "uai_admin"
        ],
        "locale": "en",
        "fullname": "fake",
        "createdAt": "2017-08-24 10:18:30",
        "isEnabled": true,
        "prototype": false,
        "lastAuthenticationAt": null
      }
    ]
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

User with password signup

This is a public endpoint used by the BFF to create users with required email activation in the website.

Signup User
POST/signup

Example URI

POST https://user-identity.spotahome.com/signup
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "fullname": "John Smith",
  "email": "user@domain.com",
  "password": "12345678",
  "activation_callback_url": "http://spotahome.com/bff/users/activation/:id",
  "locale": "en",
  "role": "uai_role"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "fullname": {
      "type": "string"
    },
    "email": {
      "type": "string"
    },
    "password": {
      "type": "string"
    },
    "activation_callback_url": {
      "type": "string"
    },
    "locale": {
      "type": "string"
    },
    "role": {
      "type": "string"
    }
  },
  "required": [
    "fullname",
    "email",
    "password",
    "activation_callback_url",
    "locale"
  ]
}
Response  201
HideShow
Headers
Location: /users/68a5sdf67
Response  409
HideShow

This happens when a user with the same email already exists. The content of the validationMessages fields is always email.emailAlreadyInUse

Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "email": {
      "emailAlreadyInUse": "Email already in use"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "email": {
          "type": "object",
          "properties": {
            "emailAlreadyInUse": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "fullname": {
      "stringLengthTooShort": "The input is less than 4 characters long"
    },
    "email": {
      "emailAddressInvalidFormat": "The input is not a valid email address. Use the basic format local",
      "emailDomainNotAllowed": "The email hola@spotahome.com cannot be a tenant!"
    },
    "password": {
      "stringLengthTooShort": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "fullname": {
          "type": "object",
          "properties": {
            "stringLengthTooShort": {
              "type": "string"
            }
          }
        },
        "email": {
          "type": "object",
          "properties": {
            "emailAddressInvalidFormat": {
              "type": "string",
              "description": "part@domain"
            },
            "emailDomainNotAllowed": {
              "type": "string"
            }
          }
        },
        "password": {
          "type": "object",
          "properties": {
            "stringLengthTooShort": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

User

Create social user
POST/users

Create social users for the backoffice.

Authorization: protected for uai_admin roles and/or the user himself.

Example URI

POST https://user-identity.spotahome.com/users
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "fullname": "John Smith",
  "email": "user@domain.com",
  "locale": "en",
  "roles": [
    "uai_employee",
    "bookings_bonsai_edit"
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "fullname": {
      "type": "string"
    },
    "email": {
      "type": "string"
    },
    "locale": {
      "type": "string"
    },
    "roles": {
      "type": "array"
    }
  },
  "required": [
    "fullname",
    "email",
    "locale",
    "roles"
  ]
}
Response  201
HideShow
Headers
Location: /users/68a5sdf67
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Get user by id
GET/users/{id}

Retrieve user information

Authorization: protected for uai_admin, uai_employee and uai_user_manager role

Example URI

GET https://user-identity.spotahome.com/users/68a5sdf67
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "68a5sdf67",
  "fullname": "John Smith",
  "locale": "es_ES",
  "roles": [
    "foo",
    "bar"
  ],
  "email": "user@domain.com",
  "createdAt": "2004-02-12T15:20:21+00:00",
  "lastAuthenticationAt": "2004-02-12T15:20:21+00:00",
  "isEnabled": true
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Get user by token
GET/users/me

Example URI

GET https://user-identity.spotahome.com/users/me
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "68a5sdf67",
  "fullname": "John Smith",
  "locale": "es_ES",
  "roles": [
    "foo",
    "bar"
  ],
  "email": "user@domain.com",
  "createdAt": "2004-02-12T15:20:21+00:00",
  "lastAuthenticationAt": "2004-02-12T15:20:21+00:00",
  "isEnabled": true
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

Validate user on critical actions
GET/users/me/verify

Validate user on critical actions and do not rely on JWT expiration date.

Example URI

GET https://user-identity.spotahome.com/users/me/verify
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  204
HideShow
Headers
Content-Type: application/json
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  403
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "User '00000000",
  "status": 403,
  "title": "Forbidden",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string",
      "description": "0000-0000-0000-000000000000' cannot impersonate as '11111111-1111-1111-1111-111111111111' (string)"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Enable / Disable

Ability to avoid users to login.

Authorization: protected for uai_admin roles.

Enable
PUT/users/{id}/enabling

Example URI

PUT https://user-identity.spotahome.com/users/68a5sdf67/enabling
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  204
Response  400
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 400,
  "title": "Bad Request",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Disable
DELETE/users/{id}/enabling

Example URI

DELETE https://user-identity.spotahome.com/users/68a5sdf67/enabling
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  204
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Activation

Activate user
PUT/users/activation/{activationCode}

When a user with password is created in the website, an activation email is sent to the user’s email. This endpoint will be executed when the user tries to open the link in the email in order to activate the account (aka validating the email).

Example URI

PUT https://user-identity.spotahome.com/users/activation/68a5sdf67
URI Parameters
HideShow
activationCode
string (required) Example: 68a5sdf67

The activation code associated to the user.

Request
HideShow
Headers
Content-Type: application/json
Response  204
HideShow
Headers
Location: /users/123abc
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Resend activation
POST/users/activation/{id}

Resend activation link by email that was already created.

Example URI

POST https://user-identity.spotahome.com/users/activation/68a5sdf67
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "activation_callback_url": "http://spotahome.com/bff/users/activation/:id"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "activation_callback_url": {
      "type": "string"
    }
  },
  "required": [
    "activation_callback_url"
  ]
}
Response  204
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Add / Remove set of roles

Ability to add or remote roles from a specific user.

Authorization: protected for uai_admin roles.

Add
POST/users/{id}/roles

Add a specific role to a user.

Example URI

POST https://user-identity.spotahome.com/users/68a5sdf67/roles
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "role": "bookings_bonsai_edit"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "role": {
      "type": "string"
    }
  },
  "required": [
    "role"
  ]
}
Response  204
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Remove
DELETE/users/{id}/roles/{role}

Remove a specific role to a User.

Example URI

DELETE https://user-identity.spotahome.com/users/68a5sdf67/roles/bookings_bonsai_edit
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

role
string (required) Example: bookings_bonsai_edit
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  204
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Impersonation

Impersonate as another user
POST/users/{id}/impersonate

Creates a JWT token with the user’s data, and a new impersonated_user_id attribute in the payload. Currently, these impersonations are allowed:

  • Role uai_admin can impersonate any user that isn’t a uai_admin. This means, admins can impersonate as any non-admin user.

  • Role ROLE_PROPERTY_ACQUISITION_AGENT can impersonate as a user with the role ROLE_ACCOMMODATION_PROVIDER. This means agents can impersonate as landlords.

Example URI

POST https://user-identity.spotahome.com/users/68a5sdf67/impersonate
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID who will be impersonated

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  403
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "User '00000000",
  "status": 403,
  "title": "Forbidden",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string",
      "description": "0000-0000-0000-000000000000' cannot impersonate as '11111111-1111-1111-1111-111111111111' (string)"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Update User's email

Updates user’s email by an admin user.

Authorization: protected for uai_admin roles.

Admin update email
PUT/admin/users/{id}/email

Example URI

PUT https://user-identity.spotahome.com/admin/users/68a5sdf67/email
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
    "email"  : "user@domain.com",
    "notify" : true   // default value
}
Response  204
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Update User's information

Updates user’s fullname and locale by an admin user

Authorization: protected for uai_admin roles.

Admin update information
PUT/admin/users/{id}/information

Example URI

PUT https://user-identity.spotahome.com/admin/users/68a5sdf67/information
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "fullname": "John Snow",
  "locale": "es"
}
Response  204
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

User request email's change

Create a request for changing the user’s email. Send by the user himself

Authorization: protected for user (user token).

User request email's change
POST/me/email-change

Example URI

POST https://user-identity.spotahome.com/me/email-change
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "email": "user@domain.com",
  "callback_url": "http://spotahome.com/bff/landlord/email/:id"
}
Response  204
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Verify User's email change

Verify the email change’s request and update the user’s email

User update email
PUT/email/verification/{checksum}

Example URI

PUT https://user-identity.spotahome.com/email/verification/abcabcabcabcabcabc
URI Parameters
HideShow
checksum
string (required) Example: abcabcabcabcabcabc

The user ID

Request
HideShow
Headers
Content-Type: application/json
Response  204
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Update user information

Update user fullname and locale

Authorization: protected for user (user token).

User updates information
PUT/me/information

Example URI

PUT https://user-identity.spotahome.com/me/information
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "fullname": "John Snow",
  "locale": "en"
}
Response  204
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Forgotten passwords

Forgotten password

Create
POST/forgotten-passwords

Example URI

POST https://user-identity.spotahome.com/forgotten-passwords
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "email": "user@domain.com",
  "callback_url": "http://spotahome.com/bff/landlord/password/:id"
}
Response  201
HideShow
Headers
Location: /forgotten-passwords/68a5sdf67
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Forgotten password

Get forgotten password
GET/forgotten-passwords/{id}

Example URI

GET https://user-identity.spotahome.com/forgotten-passwords/68a5sdf67
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The forgotten password ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "expiration_date": "01/01/2000"
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Forgotten password

Set new password
PUT/forgotten-passwords/{id}/password

Example URI

PUT https://user-identity.spotahome.com/forgotten-passwords/68a5sdf67/password
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The forgotten password ID

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "password": "123456"
}
Response  204
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Authentication

Authentication

We return a pair of tokens:

  • Access Token: it can be used to access APIs

  • Refresh Token: it can be used to request a new access token

Authenticate a user
POST/authentications

Example URI

POST https://user-identity.spotahome.com/authentications
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "email": "user@domain.com",
  "password": "foo123",
  "login_context": "landlord"
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  422
HideShow

This example shows multiple errors in the same body. But only emailAddressInvalidFormat and password’s stringLengthTooShort can appear at the same time. All other possible values exclude any other error.

Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "email": {
      "emailAddressInvalidFormat": "The input is not a valid email address. Use the basic format local",
      "userNotExists": "This user does not exist",
      "authenticationMethodNotSupported": "The authentication method provided cannot be used by this user",
      "userIsDisabled": "User is Disabled",
      "userIsPrototype": "User is a prototype"
    },
    "password": {
      "stringLengthTooShort": "The input is less than 6 characters long",
      "invalidPassword": "The password is invalid"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "email": {
          "type": "object",
          "properties": {
            "emailAddressInvalidFormat": {
              "type": "string",
              "description": "part@hostname"
            },
            "userNotExists": {
              "type": "string"
            },
            "authenticationMethodNotSupported": {
              "type": "string"
            },
            "userIsDisabled": {
              "type": "string"
            },
            "userIsPrototype": {
              "type": "string"
            }
          }
        },
        "password": {
          "type": "object",
          "properties": {
            "stringLengthTooShort": {
              "type": "string"
            },
            "invalidPassword": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Google

Google authentication follows the Oauth protocol.

Authorization DEPRECATED
GET/authentications/google{?redirect_uri,state}

Generates an authorization url that will be used to redirect the user to authenticate in a google login page.

Example URI

GET https://user-identity.spotahome.com/authentications/google?redirect_uri=http:/bff.spotahome.com/google/check&state=aabbccdd45nnaa
URI Parameters
HideShow
redirect_uri
string (optional) Example: http://bff.spotahome.com/google/check

Google after authenticating redirects to this url

state
string (optional) Example: aabbccdd45nnaa

Current state encoded in base64 (e.g. isSubscribed, locale, etc)

Request
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "authorization_url": "https://accounts.google.com/o/oauth2/auth?state=fe613f8765&scope=email%20openid%20profile&response_type=code&approval_prompt=auto&redirect_uri=%27%27&client_id=dvdunjtfnb.apps.googleusercontent.com&authuser=-1",
  "oauth2state": "fe613f87650b568dbb49edcc6edbccfb"
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Authentication DEPRECATED
POST/authentications/google

Authenticates in Google Oauth API and verifies if the account exists and it is enabled. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/authentications/google
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "code": "fe613f87650b568dbb49e",
  "redirect_uri": "http://bff.spotahome.com/google/check",
  "login_context": "tenant",
  "locale": "en"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "string"
    },
    "redirect_uri": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of types tenant, landlord or employee"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    }
  },
  "required": [
    "code",
    "redirect_uri",
    "login_context",
    "locale"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Authentication
POST/oauth/google

Authenticates in Google Oauth API with an access token and verifies if the account exists and it is enabled. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/oauth/google
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "access_token": "fe613f87650b568dbb49e",
  "login_context": "tenant",
  "locale": "en"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "access_token": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of types tenant, landlord or employee"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    }
  },
  "required": [
    "access_token",
    "login_context",
    "locale"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Authentication using Google Sing in One Tap
POST/oauth/sign-in-google

Verifies the credential from Google One Tap and authenticates the user. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/oauth/sign-in-google
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "credential": "fjhs97hjklashd123",
  "login_context": "tenant",
  "locale": "en"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "credential": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of types tenant, landlord or employee"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    }
  },
  "required": [
    "credential",
    "login_context",
    "locale"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Facebook

Facebook authentication follows the Oauth protocol.

Authorization DEPRECATED
GET/authentications/facebook{?redirect_uri,state}

Generates an authorization url that will be used to redirect the user to authenticate in a facebook login page.

Example URI

GET https://user-identity.spotahome.com/authentications/facebook?redirect_uri=http:/bff.spotahome.com/facebook/check&state=aabbccdd45nnaa
URI Parameters
HideShow
redirect_uri
string (optional) Example: http://bff.spotahome.com/facebook/check

Facebook after authenticating redirects to this url

state
string (optional) Example: aabbccdd45nnaa

Current state encoded in base64 (e.g. isSubscribed, locale, etc)

Request
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "authorization_url": "https://www.facebook.com/v2.10/dialog/oauth?0=email&1=public_profile&state=b400ccac0772117cac330a6ff8f72293&scope=public_profile%2Cemail&response_type=code&approval_prompt=auto&redirect_uri=https%3A%2F%2Fwww.spotahome.com&client_id=250342588822106",
  "oauth2state": "b400ccac0772117cac330a6ff8f72293"
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Authentication DEPRECATED
POST/authentications/facebook

Authenticates in Facebook API and verifies if the account exists and it is enabled. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/authentications/facebook
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "code": "fe613f87650b568dbb49e",
  "redirect_uri": "http://bff.spotahome.com/facebook/check",
  "login_context": "tenant",
  "locale": "en"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "string"
    },
    "redirect_uri": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of types tenant, landlord or employee"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    }
  },
  "required": [
    "code",
    "redirect_uri",
    "login_context",
    "locale"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Authentication
POST/oauth/facebook

Authenticates in Facebook API with an access token and verifies if the account exists and it is enabled. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/oauth/facebook
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "access_token": "fe613f87650b568dbb49e",
  "login_context": "tenant",
  "locale": "en"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "access_token": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of types tenant, landlord or employee"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    }
  },
  "required": [
    "access_token",
    "login_context",
    "locale"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Apple

Authenticates with Apple Oauth

Apple
POST/oauth/apple

Authenticates with Apple an access token and verifies if the account exists and it is enabled. To be precise, we check that the access token provided was issued by Apple, calling their servers, we don’t really authenticate since this is happening in the tenant app side. When sign-up a user, we need to specify the full_name. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/oauth/apple
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "access_token": "fe613f87650b568dbb49e",
  "login_context": "tenant",
  "locale": "en",
  "full_name": "'Steve Jobs'"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "access_token": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of types tenant, landlord or employee"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    },
    "full_name": {
      "type": "string",
      "description": "User name used when creating the account"
    }
  },
  "required": [
    "access_token",
    "login_context",
    "locale"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Erasmusu

Erasmusu Auth. Login and signup with access token from Erasmusu Auth service.

Erasmusu
POST/oauth/erasmusu

Authenticates in Erasmusu authentication service with an access token and verifies if the account exists and it is enabled. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/oauth/erasmusu
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "access_token": "fe613f87650b568dbb49e",
  "login_context": "tenant",
  "locale": "en"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "access_token": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of type of tenant"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    }
  },
  "required": [
    "access_token",
    "login_context",
    "locale"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

WGGesucht

WGGesucht Auth. Login and signup with access token from WGGesucht Auth service.

WGGesucht
POST/oauth/wgg

Authenticates in WGGesucht authentication service with an access token and verifies if the account exists and it is enabled. Returns a pair of JWT token if authenticated successfully: access token and refresh token.

Example URI

POST https://user-identity.spotahome.com/oauth/wgg
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "access_token": "fe613f87650b568dbb49e",
  "login_context": "tenant",
  "locale": "en"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "access_token": {
      "type": "string"
    },
    "login_context": {
      "type": "string",
      "description": "Can be of type of tenant"
    },
    "locale": {
      "type": "string",
      "description": "Identifies the locale of the user that wants to authenticate"
    }
  },
  "required": [
    "access_token",
    "login_context",
    "locale"
  ]
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  409
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request could not be completed due to a conflict with the current state of the resource",
  "status": 409,
  "title": "Conflict",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "the error code and the description."
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Token Info

JWT info
GET/me

Different audiences:

  • access_token: Token with the purpose of access APIs

  • refresh_token: Token with the purpose of request a new access token

Example URI

GET https://user-identity.spotahome.com/me
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
    "jwt" : {
        "header" : {
            "typ" : "JWT",
            "alg" : "HS512"
        },
        "payload" : {
            "sub": "598b1084-20fc-4df2-b3e6-cd0cf2065848",
            "aud": "access_token",
            "jti": "fcf3bf9b-b199-48df-bb69-6afa3013bbe3",
            "exp" : "1470220576",
            "iat" : "1470220533"
            "iss" : "spotahome.com",
            "user_id": "598b1084-20fc-4df2-b3e6-cd0cf2065848",
            "roles" : [
                "foo",
                "bar"
            ]
    }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

Refresh access token

Refresh access token
POST/authentications/me/refresh

Mandatory: Token used needs to be a refresh token with the audience “refresh_token”

Example URI

POST https://user-identity.spotahome.com/authentications/me/refresh
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "jwt": "aa.bb.cc",
  "accessToken": "aa.bb.cc",
  "refreshToken": "dd.ee.ff"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "jwt": {
      "type": "string",
      "description": "Deprecated field. Use accessToken instead, it has same value."
    },
    "accessToken": {
      "type": "string",
      "description": "The access token to use for access to APIs."
    },
    "refreshToken": {
      "type": "string",
      "description": "The refresh token to use for request new access tokens"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

Event Store

Event Store

Get Events
GET/event-store/{fromEventId}/{toEventId}{?typeName}

Gets a specific set of domain events from a specific interval. A maximum of 500 results will be shown if more are requested.

Example URI

GET https://user-identity.spotahome.com/event-store/1/100?typeName=SocialUserWasRegistered,UserWasCreated
URI Parameters
HideShow
fromEventId
number (required) Example: 1

From domain event id

toEventId
number (required) Example: 100

To domain event id

typeName
array[string] (optional) Example: SocialUserWasRegistered,UserWasCreated

Event typename

Request
HideShow
Headers
Authorization: aa.bb.cc
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "events": [
    {
      "id": "1",
      "type_name": "Sah\\Domain\\User\\UserRoleWasAdded",
      "occurred_on": "2017-07-03T11:20:35.000Z",
      "event_body": "{\"role\":\"booking-agent\",userId\":\"5b9f90a5-a0e5-4d29-b660-f337fa314748\",\"occurredOn\":\"2017-07-03T11:20:35+0000\"}"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "events": {
      "type": "array"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

Profiles

Profiles

Get Profile
GET/profiles/me

Returns the profile for the current user, identified by the authentication token.

A user can only read its own profile.

Example URI

GET https://user-identity.spotahome.com/profiles/me
Request
HideShow
Headers
Authorization: aa.bb.cc
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "phone": "123456789",
  "birthday": "2000-12-31",
  "gender": "female",
  "occupationType": "professional",
  "occupationOrganization": "Company Name",
  "occupationDescription": "Software engineer",
  "country": "spain",
  "isCouple": true,
  "aboutMe": "More info about me",
  "solvency": "family_support",
  "salaryFrom": 10,
  "salaryTo": 100,
  "salaryCurrency": "GBP",
  "salaryType": "monthly",
  "contacts": [
    {
      "firstName": "John",
      "lastName": "Doe",
      "email": "johndoe@test.com",
      "phone": "123456789",
      "types": "cohabitant"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "phone": {
      "type": "string"
    },
    "birthday": {
      "type": "string",
      "description": "Birth date (format YYYY-MM-DD)"
    },
    "gender": {
      "type": "string",
      "enum": [
        "female",
        "male"
      ]
    },
    "occupationType": {
      "type": "string",
      "enum": [
        "professional",
        "student"
      ]
    },
    "occupationOrganization": {
      "type": "string"
    },
    "occupationDescription": {
      "type": "string",
      "description": "What they do/study"
    },
    "country": {
      "type": "string"
    },
    "isCouple": {
      "type": "boolean"
    },
    "aboutMe": {
      "type": "string"
    },
    "solvency": {
      "type": "string",
      "enum": [
        "family_support",
        "savings",
        "scholarship",
        "work"
      ],
      "description": "Where the funds are coming from"
    },
    "salaryFrom": {
      "type": "number",
      "description": "Salary range from"
    },
    "salaryTo": {
      "type": "number",
      "description": "Salary range to"
    },
    "salaryCurrency": {
      "type": "string",
      "description": "Currency ISO_4217"
    },
    "salaryType": {
      "type": "string",
      "enum": [
        "monthly"
      ],
      "description": "Salary type"
    },
    "contacts": {
      "type": "array"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Create OR Update a Profile
PUT/profiles/me

Create a profile, if it doesn’t exist already, or update an existing profile.

The profile is for the current user, identified by the authentication token.

If the user doesn’t have a profile already, a new one will be created.

If the user already has a profile, it will be updated.

  • The following attributes will not be updated if they are NULL or non existing in the payload
    • occupationDescription
    • solvency
    • salaryFrom
    • salaryTo
    • salaryCurrency
    • salaryType
    • address: { fullAddress, streetName, streetNumber, addressDetails, postalCode, cityId, countryCode, }

A user can only update its own profile.

Example URI

PUT https://user-identity.spotahome.com/profiles/me
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "phone": "123456789",
  "birthday": "2000-12-31",
  "gender": "female",
  "occupationType": "professional",
  "occupationOrganization": "Company Name",
  "occupationDescription": "Software engineer",
  "country": "spain",
  "isCouple": true,
  "aboutMe": "More info about me",
  "solvency": "family_support",
  "salaryFrom": 10,
  "salaryTo": 100,
  "salaryCurrency": "GBP",
  "salaryType": "monthly",
  "contacts": [
    {
      "firstName": "John",
      "lastName": "Doe",
      "email": "johndoe@test.com",
      "phone": "123456789",
      "types": "cohabitant"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "phone": {
      "type": "string"
    },
    "birthday": {
      "type": "string",
      "description": "Birth date (format YYYY-MM-DD)"
    },
    "gender": {
      "type": "string",
      "enum": [
        "female",
        "male"
      ]
    },
    "occupationType": {
      "type": "string",
      "enum": [
        "professional",
        "student"
      ]
    },
    "occupationOrganization": {
      "type": "string"
    },
    "occupationDescription": {
      "type": "string",
      "description": "What they do/study"
    },
    "country": {
      "type": "string"
    },
    "isCouple": {
      "type": "boolean"
    },
    "aboutMe": {
      "type": "string"
    },
    "solvency": {
      "type": "string",
      "enum": [
        "family_support",
        "savings",
        "scholarship",
        "work"
      ],
      "description": "Where the funds are coming from"
    },
    "salaryFrom": {
      "type": "number",
      "description": "Salary range from"
    },
    "salaryTo": {
      "type": "number",
      "description": "Salary range to"
    },
    "salaryCurrency": {
      "type": "string",
      "description": "Currency ISO_4217"
    },
    "salaryType": {
      "type": "string",
      "enum": [
        "monthly"
      ],
      "description": "Salary type"
    },
    "contacts": {
      "type": "array"
    }
  }
}
Response  204
HideShow
Headers
Location: /profiles/me
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Profiles by ID

Get Profile by ID
GET/profiles/{id}

Get profile by id.

Authorization: protected for uai_admin and uai_employee roles.

Example URI

GET https://user-identity.spotahome.com/profiles/68a5sdf67
URI Parameters
HideShow
id
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Authorization: aa.bb.cc
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "phone": "123456789",
  "birthday": "2000-12-31",
  "gender": "female",
  "occupationType": "professional",
  "occupationOrganization": "Company Name",
  "occupationDescription": "Software engineer",
  "country": "spain",
  "isCouple": true,
  "aboutMe": "More info about me",
  "solvency": "family_support",
  "salaryFrom": 10,
  "salaryTo": 100,
  "salaryCurrency": "GBP",
  "salaryType": "monthly",
  "contacts": [
    {
      "firstName": "John",
      "lastName": "Doe",
      "email": "johndoe@test.com",
      "phone": "123456789",
      "types": "cohabitant"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "phone": {
      "type": "string"
    },
    "birthday": {
      "type": "string",
      "description": "Birth date (format YYYY-MM-DD)"
    },
    "gender": {
      "type": "string",
      "enum": [
        "female",
        "male"
      ]
    },
    "occupationType": {
      "type": "string",
      "enum": [
        "professional",
        "student"
      ]
    },
    "occupationOrganization": {
      "type": "string"
    },
    "occupationDescription": {
      "type": "string",
      "description": "What they do/study"
    },
    "country": {
      "type": "string"
    },
    "isCouple": {
      "type": "boolean"
    },
    "aboutMe": {
      "type": "string"
    },
    "solvency": {
      "type": "string",
      "enum": [
        "family_support",
        "savings",
        "scholarship",
        "work"
      ],
      "description": "Where the funds are coming from"
    },
    "salaryFrom": {
      "type": "number",
      "description": "Salary range from"
    },
    "salaryTo": {
      "type": "number",
      "description": "Salary range to"
    },
    "salaryCurrency": {
      "type": "string",
      "description": "Currency ISO_4217"
    },
    "salaryType": {
      "type": "string",
      "enum": [
        "monthly"
      ],
      "description": "Salary type"
    },
    "contacts": {
      "type": "array"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Documents

Generate an upload url

Generate an upload url
POST/me/documents/upload-url

Returns a signed url which allows to make a PUT request to upload a file directly to S3.

Example URI

POST https://user-identity.spotahome.com/me/documents/upload-url
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "filetype": "image/png"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "filetype": {
      "type": "string"
    }
  }
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "signedUploadUrl": "https://bucket-name.s3....com/abcde/fghij",
  "filePath": "abcde/fghij"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "signedUploadUrl": {
      "type": "string"
    },
    "filePath": {
      "type": "string"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

Save uploaded document

Save uploaded document
POST/me/documents

Saves the given document filepath as owned by a given user.

Example URI

POST https://user-identity.spotahome.com/me/documents
Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Body
{
  "filePath": "'abcde/fghi'",
  "documentType": "id_front"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "filePath": {
      "type": "string"
    },
    "documentType": {
      "type": "string",
      "enum": [
        "id_front",
        "id_back",
        "proof_of_income",
        "proof_of_income_additional"
      ]
    }
  }
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {}
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

Document download url

Document download url
GET/documents/{documentId}/download?expires={expires}

Gets the S3 signed url to download a document.

This endpoint requires and “uai_admin” or a “uai_tenant_document_manager” jwt token.

Example URI

GET https://user-identity.spotahome.com/documents/abcdefg/download?expires=120
URI Parameters
HideShow
documentId
string (required) Example: abcdefg

The uuid of the document.

expires
integer (optional) Example: 120

Number of seconds the link will be valid.

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  200
HideShow
Body
{
  "signedDownloadUrl": "https://bucket-name.s3....com/abcde/fghij"
}
Schema
{
  "type": "object",
  "properties": {
    "signedDownloadUrl": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Document download url by path

Document download url by path
GET/documents/{userId}/{filename}/download-url?expires={expires}

Gets the S3 signed url to download a document.

This endpoint requires and “uai_admin” or a “uai_tenant_document_manager” jwt token.

Example URI

GET https://user-identity.spotahome.com/documents/abcdefg/abcdefg/download-url?expires=120
URI Parameters
HideShow
userId
string (required) Example: abcdefg

The uuid of the user owner of the document.

filename
string (required) Example: abcdefg

The filename of the document.

expires
integer (optional) Example: 120

Number of seconds the link will be valid.

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  200
HideShow
Body
{
  "signedDownloadUrl": "https://bucket-name.s3....com/abcde/fghij"
}
Schema
{
  "type": "object",
  "properties": {
    "signedDownloadUrl": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}

Delete a document

Delete a document
DELETE/documents/{documentId}

Unlink a document from a user. This doesn’t delete the file from S3.

Example URI

DELETE https://user-identity.spotahome.com/documents/abcdefg
URI Parameters
HideShow
documentId
string (required) Example: abcdefg

The uuid of the document.

Request
HideShow
Headers
Content-Type: application/json
Authorization: aa.bb.cc
Response  204
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}

Get documents from a user

Get documents from a user
GET/{userId}/documents

Get all documents from a user.

This endpoint requires and “uai_admin” or a “uai_tenant_document_manager” jwt token.

Example URI

GET https://user-identity.spotahome.com/68a5sdf67/documents
URI Parameters
HideShow
userId
string (required) Example: 68a5sdf67

The user ID

Request
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "count": 2,
  "total": 2,
  "_links": {
    "self": {
      "href": "/64d5234f-4b9a-4b8b-bc74-d5eb8340af5f/documents?page=1"
    },
    "first": {
      "href": "/64d5234f-4b9a-4b8b-bc74-d5eb8340af5f/documents?page=1"
    },
    "last": {
      "href": "/64d5234f-4b9a-4b8b-bc74-d5eb8340af5f/documents?page=1"
    }
  },
  "_embedded": {
    "documents": [
      {
        "id": "aaaaa-bbbb-cccc",
        "userId": "aaaaa-bbbb-cccc",
        "filePath": "64d5234f-4b9a-4b8b-bc74-d5eb8340af5f/6765d4e9-4a8c-43c5-a7a9-4be8e54e6efc",
        "uploadedAt": "2022-09-07 11:57:15",
        "documentType": "id_back"
      }
    ]
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "count": {
      "type": "number"
    },
    "total": {
      "type": "number"
    },
    "_links": {
      "type": "object",
      "properties": {
        "self": {
          "type": "object",
          "properties": {
            "href": {
              "type": "string"
            }
          },
          "required": [
            "href"
          ]
        },
        "first": {
          "type": "object",
          "properties": {
            "href": {
              "type": "string"
            }
          },
          "required": [
            "href"
          ]
        },
        "last": {
          "type": "object",
          "properties": {
            "href": {
              "type": "string"
            }
          },
          "required": [
            "href"
          ]
        }
      },
      "required": [
        "self",
        "first",
        "last"
      ]
    },
    "_embedded": {
      "type": "object",
      "properties": {
        "documents": {
          "type": "array"
        }
      }
    }
  },
  "required": [
    "count",
    "total",
    "_links"
  ]
}

List document types

List document types
GET/documents/types

Example URI

GET https://user-identity.spotahome.com/documents/types
Request
HideShow
Headers
Content-Type: application/json
Response  200
HideShow
Body
[
  "id_front",
  "id_back",
  "proof_of_income",
  "proof_of_income_additional",
  "proof_of_occupation"
]
Schema
{
  "type": "array",
  "items": {
    "type": "string"
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}

Phone verification

Phone verification

Request phone verification
POST/phone-verifications

Request a verification code to be sent to the user.

Events triggered

  • PhoneVerificationWasCreated

Example URI

POST https://user-identity.spotahome.com/phone-verifications
Request
HideShow
Headers
Authorization: aa.bb.cc
Body
{
  "phone": "+447123456789",
  "channel": "sms",
  "locale": "en"
}
Schema
{
  "type": "object",
  "properties": {
    "phone": {
      "type": "string"
    },
    "channel": {
      "enum": [
        "sms",
        "call"
      ]
    },
    "locale": {
      "enum": [
        "en",
        "es",
        "it",
        "pt"
      ]
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "VE453d6d20ab80da21",
  "phone": "+447123456789",
  "channel": "sms",
  "status": "pending"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "phone": {
      "type": "string"
    },
    "channel": {
      "type": "string",
      "enum": [
        "sms",
        "call"
      ]
    },
    "status": {
      "type": "string"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Phone verification check

Phone verification check
POST/phone-verifications/check

Check whether the code is correct against a pending verification request. If code is correct, updates the state to approved.

Events triggered

  • PhoneVerificationWasApproved
    • PhoneVerificationWasInvalid

Example URI

POST https://user-identity.spotahome.com/phone-verifications/check
Request
HideShow
Headers
Authorization: aa.bb.cc
Body
{
  "phone": "+447123456789",
  "code": "123456"
}
Schema
{
  "type": "object",
  "properties": {
    "phone": {
      "type": "string"
    },
    "code": {
      "type": "string"
    }
  },
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "VE453d6d20ab80da21",
  "phone": "+447123456789",
  "channel": "sms",
  "status": "pending",
  "valid": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "phone": {
      "type": "string"
    },
    "channel": {
      "type": "string",
      "enum": [
        "sms",
        "call"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "approved"
      ]
    },
    "valid": {
      "type": "boolean"
    }
  }
}
Response  401
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request requires user authentication",
  "status": 401,
  "title": "Unauthorized",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains the error code and the description"
    }
  }
}
Response  404
HideShow

Pending phone verification not found.

Headers
Content-Type: application/problem+json
Body
{
  "detail": "Resource not found",
  "status": 404,
  "title": "Not found",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    }
  }
}
Response  422
HideShow
Headers
Content-Type: application/problem+json
Body
{
  "detail": "The request was well formed but was unable to be followed due to semantic errors",
  "status": 422,
  "title": "Unprocessable Entity",
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616",
  "validationMessages": {
    "field": {
      "stringLength": "The input is less than 6 characters long"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "detail": {
      "type": "string"
    },
    "status": {
      "type": "number"
    },
    "title": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "description": "sec10.html (string)"
    },
    "validationMessages": {
      "type": "object",
      "properties": {
        "field": {
          "type": "object",
          "properties": {
            "stringLength": {
              "type": "string"
            }
          }
        }
      },
      "description": "Contains a property for each field that failed validation."
    }
  }
}

Event Schema

Generated by aglio on 04 Dec 2025