Address

Reference

Billing

Cards, yearly prices, the monthly sending allowance, overage and the hard stop.

Markdown

Calls go to https://address.seleya.ai/api. A refusal is {"error": {"code", "message"}} with its status; every code is in Errors.

Billing

GET /v1/billing

Called with a key or a person signed in.

The owner's payment status, plan and price, card, the month's sending allowance (with overage and the hard stop), and the next charge.

Parameters

owner string, in query
Who pays. Defaults to you.

Answers

200
Done
401
No valid key, session or token
403
Not allowed for this caller
404
Not found, or not yours to see
503
Payments are not open here yet
Fields of the 200 answer
status string
none, checking, ready_to_pay, payment_required, active, past_due, cancelled, refused or review. First-payment failure never activates mail.
reason string, or null
Why the status is what it is, when it isn't active.
plan string
company or person.
price object
What this owner pays.
allowance object, or null
This month's sending: 1,000 sends for each paid-for address, pooled.
next object, or null
The next charge, when a subscription runs.
card object
The card that pays: brand, last four digits, funding, country and the 3-D Secure result.
receive_only boolean
A prepaid card pays, so the addresses receive but don't send.
billable integer
The addresses paid for: the owner's active ones.
customer object
The Stripe customer id.
owner object
Whose billing this is: id, name and kind.
capabilities Capabilities
card_state string, or null
card_pending boolean
purchase object, or null
payment object, or null
invoices array of objects
curl https://address.seleya.ai/api/v1/billing \
  -H "Authorization: Bearer $SELEYA_KEY"

Answer 200
{
  "allowance": {
    "hard_stop": false,
    "included": 1000,
    "included_used": 0,
    "overage": 0
  },
  "billable": 1,
  "card": null,
  "customer": "cus_VU7sXsMd8VZkDA",
  "next": null,
  "owner": {
    "id": "7f3c9a2e-0000-4000-8000-000000000020",
    "kind": "company",
    "name": "Pay Co 10220001"
  },
  "plan": "company",
  "price": {
    "cents_per_address_year": 1800,
    "overage_cents_per_1000_sends": 100
  },
  "reason": null,
  "receive_only": false,
  "status": "none"
}

Save a card

POST /v1/billing/checkout

Called with a key or a person signed in.

Saves a card and requests 3-D Secure. Eligibility checks run before payment. Saving a card does not create a subscription; a person reviews the price and confirms purchase separately.

Body

owner string
Who pays: a company's owner id or your own. Defaults to yours.

Answers

201
Made
401
No valid key, session or token
403
Not allowed for this caller
409
Conflicts with the current state
503
Payments are not open here yet
Fields of the 201 answer
url string
curl -X POST https://address.seleya.ai/api/v1/billing/checkout \
  -H "Authorization: Bearer $SELEYA_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Answer 201
{
  "customer": "cus_VU7sXsMd8VZkDA",
  "session": "cs_test_…",
  "url": "https://checkout.stripe.com/c/pay/cs_…"
}

Invoices and card

POST /v1/billing/portal

Called by address.seleya.ai, signed in.

A person opens the Address-specific cancellation portal. Card verification, payment retries and invoice PDFs are at address.seleya.ai.

Body

owner string
Who pays. Defaults to yours.

Answers

201
Made
401
No valid key, session or token
403
Not allowed for this caller
409
Conflicts with the current state
503
Payments are not open here yet
Fields of the 201 answer
url string

Set the hard stop

POST /v1/billing/hard-stop

Called with a key or a person signed in.

Switches the hard stop at the month's sending allowance on or off. With it on, sending stops once the month's included sends are used; with it off, sends beyond them cost $1 per 1,000, added to the next charge. Anyone who can see the owner's billing may switch it on. Switching it off lets sends cost money, so for a key or an app it becomes an ask: the call answers 202 and the owner's admins get a link to approve it.

Body

owner string
Whose billing. Defaults to yours.
on boolean required
true to stop at the allowance; false to let sends beyond it go on as overage.

Answers

200
Done
202
Waiting for a person to approve switching it off
401
No valid key, session or token
403
Not allowed for this caller
404
No such owner for this caller
409
This owner has no billing yet
422
A value is refused; the message says which
503
Payments are not open here yet
Fields of the 200 answer
hard_stop boolean
Whether the hard stop is now on.
curl -X POST https://address.seleya.ai/api/v1/billing/hard-stop \
  -H "Authorization: Bearer $SELEYA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "on": true
}'

Answer 200
{
  "hard_stop": true
}

Your own address

POST /v1/me/address

Called with a key or a person signed in.

A person (or their app) makes their own address on the people's domain, seleya.me. It works once they pay.

Body

name string required
Your full name, as on your card. It is screened against sanctions lists.
country string required
Where you live, as a two-letter code such as ZA.
local string required
The name before @seleya.me: 1 to 64 of a-z, 0-9, dot, dash and underscore.
display_name string
The name people see. It must say it is an agent. Defaults to "<your name>'s agent".

Answers

201
Made
401
No valid key, session or token
403
Not allowed for this caller
409
Conflicts with the current state
422
A value is refused; the message says which
Fields of the 201 answer
id string
address string
owner_id string
display_name string
status active | retired
holder_emails array of strings
holder_person_id string, or null
screening map of string
capabilities Capabilities
approvals off | unknown_recipients | everything
curl -X POST https://address.seleya.ai/api/v1/me/address \
  -H "Authorization: Bearer $SELEYA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Ada Lovelace",
  "country": "GB",
  "local": "ada"
}'

Answer 201
{
  "address": "own@seleya.me",
  "display_name": "Test's agent",
  "holder_emails": [
    "own@acme.com"
  ],
  "holder_person_id": "7f3c9a2e-0000-4000-8000-00000000002d",
  "id": "7f3c9a2e-0000-4000-8000-00000000002e",
  "owner": {
    "id": "7f3c9a2e-0000-4000-8000-00000000002f",
    "status": "authorised_unpaid"
  },
  "owner_id": "7f3c9a2e-0000-4000-8000-00000000002f",
  "screening": {},
  "status": "active"
}

Stripe's events

POST /v1/webhooks/stripe

Called with .

For Stripe only, signed with the endpoint's secret.

Answers

200
Done
400
The request is malformed
401
No valid key, session or token

Review an annual price and optional discount after card verification

POST /v1/billing/review

Called by address.seleya.ai, signed in.

Body

owner string
An owner the signed-in person administers.
code string

Answers

200
Done
403
The error explains how to continue.
409
The error explains how to continue.
422
The error explains how to continue.
Fields of the 200 answer
purchase string
quantity integer
total_cents integer
currency string
subtotal_cents integer
annual_cents_before_discount integer
discount object, or null
card object
terms_version string

Confirm a reviewed purchase using only its verified card

POST /v1/billing/purchase

Called by address.seleya.ai, signed in.

Body

owner string
An owner the signed-in person administers.
purchase string required
accept_terms true required

Answers

200
Done
403
The error explains how to continue.
409
The error explains how to continue.
422
The error explains how to continue.
Fields of the 200 answer
status string
none, checking, ready_to_pay, payment_required, active, past_due, cancelled, refused or review. First-payment failure never activates mail.
reason string, or null
Why the status is what it is, when it isn't active.
plan string
company or person.
price object
What this owner pays.
allowance object, or null
This month's sending: 1,000 sends for each paid-for address, pooled.
next object, or null
The next charge, when a subscription runs.
card object
The card that pays: brand, last four digits, funding, country and the 3-D Secure result.
receive_only boolean
A prepaid card pays, so the addresses receive but don't send.
billable integer
The addresses paid for: the owner's active ones.
customer object
The Stripe customer id.
owner object
Whose billing this is: id, name and kind.
capabilities Capabilities
card_state string, or null
card_pending boolean
purchase object, or null
payment object, or null
invoices array of objects

Pay an existing invoice using the verified card; may return a bank confirmation URL

POST /v1/billing/payment

Called by address.seleya.ai, signed in.

Body

owner string
An owner the signed-in person administers.
invoice string required
total_cents integer required

Answers

200
Done
403
The error explains how to continue.
409
The error explains how to continue.
422
The error explains how to continue.
Fields of the 200 answer
paid boolean
processing boolean
url string

Docs