Residency

Access residency information such as postal address, city, country, zip code, province.

if you have chosen state mode while you were creating your app you can only access the residency state and document type of the user. No residency data is available.

get
Get all residency documents of a user

https://connect.synaps.io/v1/resources/residency
Return an array of residency document
Request
Response
Headers
Authorization
required
string
User access token Example : Bearer {access_token}
Content-Type
optional
string
application/json
200: OK
Residency documents of an authorized user
{
"data": [
{
"address": "16, rue de la republique",
"city": "Paris",
"country": "France",
"zipcode": "75011",
"document_type": "UTILITY_BILL",
"province": "ile-de-france",
"state": "VERIFIED"
},
{
"address": "16, rue de la republique",
"city": "Paris",
"country": "France",
"zipcode": "75011",
"document_type": "BANK_STATEMENT",
"province": "ile-de-france",
"state": "VERIFIED"
}
],
"status": {
"error": false,
"api_code": "SUCCESS",
"type": "success",
"message": "success"
}
}
400: Bad Request
Invalid authorization code
{
"data": null,
"status": {
"error": true,
"api_code": "INVALID_AUTHORIZATION_CODE",
"type": "error",
"message": "Invalid authorization code"
}
}
401: Unauthorized
Unauthorized scope
{
"data": null,
"status": {
"error": true,
"api_code": "UNAUTHORIZED_SCOPE",
"type": "error",
"message": "Unauthorized scope"
}
}

API Response

Field

Type

Description

address

string

Address

city

string

City

country

string

Country (see full country list in reference)

zipcode

string

Zip Code

province

string

Province

document_type

string

Residency document type

UTILITY_BILL - Household utility bill

GOVERNMENT_DOCUMENT - Official government issued document

BANK_STATEMENT - Bank statement

state

string

Document verification state PENDING - pending confirmation NOT_SUBMITTED - not yet submitted VERIFIED - verified

EXPIRED - expired REJECTED- rejected

Code Snippets

cURL
Java
Javascript
Node.js
Python
PHP
Ruby
Go
C#
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer access_token" \
'https://connect.synaps.io/v1/resources/residency'
// Maven : Add these dependecies to your pom.xml (java6+)
// <dependency>
// <groupId>org.glassfish.jersey.core</groupId>
// <artifactId>jersey-client</artifactId>
// <version>2.8</version>
// </dependency>
// <dependency>
// <groupId>org.glassfish.jersey.media</groupId>
// <artifactId>jersey-media-json-jackson</artifactId>
// <version>2.8</version>
// </dependency>
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
Client client = ClientBuilder.newClient();
Response response = client.target("https://connect.synaps.io/v1/resources/residency")
.request(MediaType.APPLICATION_JSON_TYPE)
.header("Accept", "application/json")
.header("Authorization", "Bearer access_token")
.get();
System.out.println("status: " + response.getStatus());
System.out.println("headers: " + response.getHeaders());
System.out.println("body:" + response.readEntity(String.class));
var request = new XMLHttpRequest();
request.open('GET', 'https://connect.synaps.io/v1/resources/residency');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('Authorization', 'Bearer access_token');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
request.send();
var request = require('request');
request({
method: 'GET',
url: 'https://connect.synaps.io/v1/resources/residency',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer access_token'
}}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer access_token'
}
request = Request('https://connect.synaps.io/v1/resources/residency', headers=headers)
response_body = urlopen(request).read()
print response_body
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://connect.synaps.io/v1/resources/residency");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Accept: application/json",
"Authorization: Bearer access_token"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
headers = {
:content_type => 'application/json',
:accept => 'application/json',
:authorization => 'Bearer access_token'
}
response = RestClient.get 'https://connect.synaps.io/v1/resources/residency', headers
puts response
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://connect.synaps.io/v1/resources/residency", nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer access_token")
resp, err := client.Do(req)
if err != nil {
fmt.Println("Errored when sending request to the server")
return
}
defer resp.Body.Close()
resp_body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(resp.Status)
fmt.Println(string(resp_body))
}
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;
var baseAddress = new Uri("https://connect.synaps.io/");
using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization", "Bearer access_token");
using(var response = await httpClient.GetAsync("v1/resources/residency"))
{
string responseData = await response.Content.ReadAsStringAsync();
}
}

get
Get specific residency document of a user

https://connect.synaps.io/v1/resources/residency
Return specific residency document
Request
Response
Headers
Authorization
required
string
User access token Example : Bearer {access_token}
Content-Type
optional
string
application/string
Query Parameters
document
required
string
Residency document type utility_bill - Household Utility Bill government_document - Government Document bank_statement - Bank Statement
200: OK
Residency document of a user
{
"data": {
"address": "16, rue de la republique",
"city": "Paris",
"country": "France",
"zipcode": "75011",
"document_type": "UTILITY_BILL",
"province": "ile-de-france",
"state": "VERIFIED"
},
"status": {
"error": false,
"api_code": "SUCCESS",
"type": "success",
"message": "success"
}
}
400: Bad Request
Invalid authorization code
{
"data": null,
"status": {
"error": true,
"api_code": "INVALID_AUTHORIZATION_CODE",
"type": "error",
"message": "Invalid authorization code"
}
}
401: Unauthorized
Unauthorized scope
{
"data": null,
"status": {
"error": true,
"api_code": "UNAUTHORIZED_SCOPE",
"type": "error",
"message": "Unauthorized scope"
}
}

API Response

Return the same residency document object described as above

Code Snippets

cURL
Java
Javascript
Node.js
Python
PHP
Ruby
Go
C#
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer access_token" \
'https://connect.synaps.io/v1/resources/residency?document={document}'
// Maven : Add these dependecies to your pom.xml (java6+)
// <dependency>
// <groupId>org.glassfish.jersey.core</groupId>
// <artifactId>jersey-client</artifactId>
// <version>2.8</version>
// </dependency>
// <dependency>
// <groupId>org.glassfish.jersey.media</groupId>
// <artifactId>jersey-media-json-jackson</artifactId>
// <version>2.8</version>
// </dependency>
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.MediaType;
Client client = ClientBuilder.newClient();
Response response = client.target("https://connect.synaps.io/v1/resources/residency?document={document}")
.request(MediaType.APPLICATION_JSON_TYPE)
.header("Accept", "application/json")
.header("Authorization", "Bearer access_token")
.get();
System.out.println("status: " + response.getStatus());
System.out.println("headers: " + response.getHeaders());
System.out.println("body:" + response.readEntity(String.class));
var request = new XMLHttpRequest();
request.open('GET', 'https://connect.synaps.io/v1/resources/residency?document={document}');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Accept', 'application/json');
request.setRequestHeader('Authorization', 'Bearer access_token');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
request.send();
var request = require('request');
request({
method: 'GET',
url: 'https://connect.synaps.io/v1/resources/residency?document={document}',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer access_token'
}}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer access_token'
}
request = Request('https://connect.synaps.io/v1/resources/residency?document={document}', headers=headers)
response_body = urlopen(request).read()
print response_body
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://connect.synaps.io/v1/resources/residency?document={document}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Accept: application/json",
"Authorization: Bearer access_token"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
headers = {
:content_type => 'application/json',
:accept => 'application/json',
:authorization => 'Bearer access_token'
}
response = RestClient.get 'https://connect.synaps.io/v1/resources/residency?document={document}', headers
puts response
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://connect.synaps.io/v1/resources/residency?document={document}", nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer access_token")
resp, err := client.Do(req)
if err != nil {
fmt.Println("Errored when sending request to the server")
return
}
defer resp.Body.Close()
resp_body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(resp.Status)
fmt.Println(string(resp_body))
}
//Common testing requirement. If you are consuming an API in a sandbox/test region, uncomment this line of code ONLY for non production uses.
//System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
//Be sure to run "Install-Package Microsoft.Net.Http" from your nuget command line.
using System;
using System.Net.Http;
var baseAddress = new Uri("https://connect.synaps.io/");
using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization", "Bearer access_token");
using(var response = await httpClient.GetAsync("v1/resources/residency?document={document}"))
{
string responseData = await response.Content.ReadAsStringAsync();
}
}