Members
Members are people with a membership on SmartPages. Their passes are issued by their memberships, so you look them up by the member’s kennitala instead of creating them through the API.
Index
POST /api/v1/member/passes- Get member passes by kennitalaPOST /api/v1/member/passes/issue- Issue a member’s pass
Get member passes by kennitala
Returns the member with that kennitala and their live memberships, each with its pass when one exists, for the issuer that owns the API key. A membership can come with pass set to null when no pass has been issued for it yet or its pass was removed: check pass before using its id or deliveryPageUrl . Look the member up by kennitala on every visit and do not store memberId : when several of your members share a kennitala, the member that answers can change.
Send the kennitala as kennitala in a JSON request body, with the Content-Type: application/json header. It travels in the body rather than in the URL, so it stays out of URLs and request logs. It is the member’s Icelandic kennitala: 10 digits, with or without the dash, e.g. 0101302399 or 010130-2399 . Spaces around it are ignored. System kennitalas (starting with 8 or 9) are not accepted.
Call this endpoint from your portal’s server, never from the member’s browser: your API key must stay secret, and the API does not accept browser requests from your own site. Once the member has logged in to your portal or site, look up their passes with their kennitala and send them to deliveryPageUrl , where they add the pass to Apple Wallet or Google Wallet. Do not send them there when the pass status is VOIDED, EXPIRED, REDEEMED, DELETE_IN_PROGRESS or DELETED. memberStatus is informational only: memberships and their pass decide whether the member has a pass to hand out. Until you issue their pass, a member whose passes are issued on request has no membership of the DK Plus membership type in the lookup. The member can hold other live memberships, so decide on the DK Plus membership, by its subscriberListId , and not on whether memberships is empty.
To send the link to a phone instead, call Send SMS for pass with the pass id . That call needs both the REST API and SMS add-ons, and a sender name registered and approved in Settings → SMS Sender names. Set content.customContent and content.customSender unless the membership’s Pass Template has an SMS Template: each value you leave out is taken from the SMS Template, and without one the call answers 400 . Put the ${url} template token in the text: SmartPages replaces it with a short link to the delivery page, and a text without it is sent without a link. Leave out phoneNumber to text the member’s phone number on file or, when the member has none, the phone number stored on the pass; with neither, the call answers 400 . Sending phoneNumber needs a phone number input field on the Pass Template and stores the number on the pass, not on the member.
An invalid kennitala answers:
{ "error": { "code": "KENNITALA_INVALID", "message": "Invalid kennitala", "possibleFixes": [ "Send a 10-digit Icelandic kennitala, with or without the dash, e.g. 0101302399 or 010130-2399" ] }}Request
POST https://smartpages-api.smartsolutions.is/api/v1/member/passes {
"kennitala": "0101302399"
} Request fields
kennitala string
Response
Example
{
"memberId": "5f1c2b3a-9d4e-4c8b-a1f2-3e4d5c6b7a89",
"kennitala": "0101302399",
"memberStatus": "ACTIVE",
"memberships": [
{
"subscriptionId": "8a7b6c5d-4e3f-4a2b-9c1d-0e1f2a3b4c5d",
"subscriptionStatus": "ACTIVE",
"subscriberListId": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
"subscriberListName": "Sample Association membership",
"pass": {
"id": "19700910-7195-4d57-b402-886ff7439e44",
"status": "ACTIVE",
"walletInstalled": true,
"deliveryPageUrl": "https://smartpages.smartsolutions.is/distribution/pass/19700910-7195-4d57-b402-886ff7439e44/2b1f0c9d-3e4a-4b5c-8d6e-7f8a9b0c1d2e",
"distributionUrl": "https://smartpages-api.smartsolutions.is/distribution/pass/19700910-7195-4d57-b402-886ff7439e44/2b1f0c9d-3e4a-4b5c-8d6e-7f8a9b0c1d2e"
}
}
]
} Fields details
memberId UUID
kennitala string
memberStatus string
memberships array
subscriptionId UUID
subscriptionStatus string
subscriberListId UUID
subscriberListName string
pass object Optional
id UUID
status string
walletInstalled boolean
deliveryPageUrl string
distributionUrl string
Code example
const myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");myHeaders.append("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>");
const raw = JSON.stringify({ "kennitala": "0101302399"});
const requestOptions = { method: "POST", headers: myHeaders, body: raw, redirect: "follow"};
try { const response = await fetch("https://smartpages-api.smartsolutions.is/api/v1/member/passes", requestOptions); const result = await response.text(); console.log(result)} catch (error) { console.error(error);};const axios = require('axios');let data = JSON.stringify({ "kennitala": "0101302399"});
let config = { method: 'post', maxBodyLength: Infinity, url: 'https://smartpages-api.smartsolutions.is/api/v1/member/passes', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer <base64(KEY_ID:KEY_TOKEN)>' }, data : data};
async function makeRequest() { try { const response = await axios.request(config); console.log(JSON.stringify(response.data)); } catch (error) { console.log(error); }}
makeRequest();import requestsimport json
url = "https://smartpages-api.smartsolutions.is/api/v1/member/passes"
payload = json.dumps({ "kennitala": "0101302399"})headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer <base64(KEY_ID:KEY_TOKEN)>'}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)val client = OkHttpClient()val mediaType = "application/json".toMediaType()val body = "{\"kennitala\":\"0101302399\"}".toRequestBody(mediaType)val request = Request.Builder() .url("https://smartpages-api.smartsolutions.is/api/v1/member/passes") .post(body) .addHeader("Content-Type", "application/json") .addHeader("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>") .build()val response = client.newCall(request).execute()var client = new HttpClient();var request = new HttpRequestMessage(HttpMethod.Post, "https://smartpages-api.smartsolutions.is/api/v1/member/passes");request.Headers.Add("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>");var content = new StringContent("{\"kennitala\":\"0101302399\"}", null, "application/json");request.Content = content;var response = await client.SendAsync(request);response.EnsureSuccessStatusCode();Console.WriteLine(await response.Content.ReadAsStringAsync());#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = reqwest::Client::builder() .build()?;
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Content-Type", "application/json".parse()?); headers.insert("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>".parse()?);
let data = r#"{ "kennitala": "0101302399"}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://smartpages-api.smartsolutions.is/api/v1/member/passes") .headers(headers) .json(&json);
let response = request.send().await?; let body = response.text().await?;
println!("{}", body);
Ok(())}Issue a member’s pass
Subscribes the member with that kennitala to their membership type, which issues their pass, and returns that membership with its pass in the same format as Get member passes by kennitala. It applies to members whose membership is managed by the DK Plus add-on when the add-on is set to issue passes on request: SmartPages keeps those members up to date from DK Plus, but a member has no pass until you ask for one here.
The lookup never issues a pass. Until the pass is issued, it carries no membership of the DK Plus membership type for such a member; any other live membership the member holds comes back as usual. Call this endpoint when the member presses your “get pass” button, not on every page view. Calling it again while the member holds the pass is harmless: it returns the same membership and pass and issues nothing new. Then send the member to deliveryPageUrl , as described above.
Send the kennitala as kennitala in a JSON request body, with the Content-Type: application/json header, exactly as for the lookup: 10 digits, with or without the dash, spaces around it ignored, system kennitalas (starting with 8 or 9) not accepted. Call this endpoint from your portal’s server, never from the member’s browser.
SmartPages decides whether the member qualifies from the status DK Plus last sent for them and the issuer’s rules, and does not ask DK Plus when you call. A member who no longer qualifies loses their pass, and has to ask again once they qualify.
A member who does not qualify answers:
{ "error": { "code": "MEMBER_NOT_ELIGIBLE", "message": "The member does not qualify for a pass", "possibleFixes": ["The member's status in the source system decides who holds a pass"] }}Request
POST https://smartpages-api.smartsolutions.is/api/v1/member/passes/issue {
"kennitala": "0101302399"
} Request fields
kennitala string
Response
Example
{
"memberId": "5f1c2b3a-9d4e-4c8b-a1f2-3e4d5c6b7a89",
"kennitala": "0101302399",
"memberStatus": "ACTIVE",
"memberships": [
{
"subscriptionId": "8a7b6c5d-4e3f-4a2b-9c1d-0e1f2a3b4c5d",
"subscriptionStatus": "ACTIVE",
"subscriberListId": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
"subscriberListName": "Sample Association membership",
"pass": {
"id": "19700910-7195-4d57-b402-886ff7439e44",
"status": "UNCLAIMED",
"walletInstalled": false,
"deliveryPageUrl": "https://smartpages.smartsolutions.is/distribution/pass/19700910-7195-4d57-b402-886ff7439e44/2b1f0c9d-3e4a-4b5c-8d6e-7f8a9b0c1d2e",
"distributionUrl": "https://smartpages-api.smartsolutions.is/distribution/pass/19700910-7195-4d57-b402-886ff7439e44/2b1f0c9d-3e4a-4b5c-8d6e-7f8a9b0c1d2e"
}
}
]
} Fields details
memberId UUID
kennitala string
memberStatus string
memberships array
subscriptionId UUID
subscriptionStatus string
subscriberListId UUID
subscriberListName string
pass object Optional
id UUID
status string
walletInstalled boolean
deliveryPageUrl string
distributionUrl string
Code example
const myHeaders = new Headers();myHeaders.append("Content-Type", "application/json");myHeaders.append("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>");
const raw = JSON.stringify({ "kennitala": "0101302399"});
const requestOptions = { method: "POST", headers: myHeaders, body: raw, redirect: "follow"};
try { const response = await fetch("https://smartpages-api.smartsolutions.is/api/v1/member/passes/issue", requestOptions); const result = await response.text(); console.log(result)} catch (error) { console.error(error);};const axios = require('axios');let data = JSON.stringify({ "kennitala": "0101302399"});
let config = { method: 'post', maxBodyLength: Infinity, url: 'https://smartpages-api.smartsolutions.is/api/v1/member/passes/issue', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer <base64(KEY_ID:KEY_TOKEN)>' }, data : data};
async function makeRequest() { try { const response = await axios.request(config); console.log(JSON.stringify(response.data)); } catch (error) { console.log(error); }}
makeRequest();import requestsimport json
url = "https://smartpages-api.smartsolutions.is/api/v1/member/passes/issue"
payload = json.dumps({ "kennitala": "0101302399"})headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer <base64(KEY_ID:KEY_TOKEN)>'}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)val client = OkHttpClient()val mediaType = "application/json".toMediaType()val body = "{\"kennitala\":\"0101302399\"}".toRequestBody(mediaType)val request = Request.Builder() .url("https://smartpages-api.smartsolutions.is/api/v1/member/passes/issue") .post(body) .addHeader("Content-Type", "application/json") .addHeader("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>") .build()val response = client.newCall(request).execute()var client = new HttpClient();var request = new HttpRequestMessage(HttpMethod.Post, "https://smartpages-api.smartsolutions.is/api/v1/member/passes/issue");request.Headers.Add("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>");var content = new StringContent("{\"kennitala\":\"0101302399\"}", null, "application/json");request.Content = content;var response = await client.SendAsync(request);response.EnsureSuccessStatusCode();Console.WriteLine(await response.Content.ReadAsStringAsync());#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = reqwest::Client::builder() .build()?;
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Content-Type", "application/json".parse()?); headers.insert("Authorization", "Bearer <base64(KEY_ID:KEY_TOKEN)>".parse()?);
let data = r#"{ "kennitala": "0101302399"}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://smartpages-api.smartsolutions.is/api/v1/member/passes/issue") .headers(headers) .json(&json);
let response = request.send().await?; let body = response.text().await?;
println!("{}", body);
Ok(())}