Skip to main content
POST
/
lists
/
portal_session
Create a portal session URL for a contact to manage their mailing list subscripitons
curl --request POST \
  --url https://api.indiepitcher.com/v1/lists/portal_session \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contactEmail": "john@acme.com",
  "returnURL": "https://example.com/projects/123456/notification_settings"
}
'
import requests

url = "https://api.indiepitcher.com/v1/lists/portal_session"

payload = {
"contactEmail": "john@acme.com",
"returnURL": "https://example.com/projects/123456/notification_settings"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contactEmail: 'john@acme.com',
returnURL: 'https://example.com/projects/123456/notification_settings'
})
};

fetch('https://api.indiepitcher.com/v1/lists/portal_session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.indiepitcher.com/v1/lists/portal_session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contactEmail' => 'john@acme.com',
'returnURL' => 'https://example.com/projects/123456/notification_settings'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.indiepitcher.com/v1/lists/portal_session"

payload := strings.NewReader("{\n \"contactEmail\": \"john@acme.com\",\n \"returnURL\": \"https://example.com/projects/123456/notification_settings\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.indiepitcher.com/v1/lists/portal_session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contactEmail\": \"john@acme.com\",\n \"returnURL\": \"https://example.com/projects/123456/notification_settings\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.indiepitcher.com/v1/lists/portal_session")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contactEmail\": \"john@acme.com\",\n \"returnURL\": \"https://example.com/projects/123456/notification_settings\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "url": "https://api.indiepitcher/lists/session/jk3434kj34j43jk3k3h433g",
    "expiresAt": "2024-08-28T08:39:17.887Z",
    "returnURL": "https://example.com/projects/123456/notification_settings"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
contactEmail
string
required

The email of a contact in your project's contact list, who to create the portal session for.

Example:

"john@acme.com"

returnURL
string
required

URL to redirect the user to when they tap on that they're cone editing their lists, or when the session is expired.

Example:

"https://example.com/projects/123456/notification_settings"

Response

200 - application/json

The URL to redirect your user to, and the expiration date of the session.

success
boolean
data
object