
Reference documentation
1. Endpoints
1.1 POST /contacts/email
Search for an SJ customer by e-mail address.
Query string parameters
None
Request body
{
“email”: “string”
} optionality: required
nullable: no
empty allowed: no
comment: Must be URL encoded
Example request
{
"email": "myemailaddress@sjmail.se"
}Response body 200
A Customer object (see schema definitions)
Response body 404
There is no SJ customer with this email address.
1.2 POST /contacts/prio-number
Search for an SJ customer by SJ Prio membership number
Query string parameters
None
Request body
{
“memberNumber”: “string”
} memberNumber
optionality: required
Nullable: no
Empty allowed: no
Comment: Note that “Prio membership number” is not the same as “Prio number”
Example request
{
"memberNumber": "9752210230122059"
} Response body 200
A Customer object (see schema definitions)
Response body 404
There is no SJ customer with this SJ Prio membership number.
1.3 POST /contacts/ssn
Search for an SJ customer by Personal Identity Number (Personnummer)
Querystring parameters
None
Request body
{
“ssn”: “string”
} ssn
optionality: required
nullable: no
empty allowed: no
Example request
{
"ssn": "199101262385"
}Response body 200
A Customer object (see schema definitions)
Response body 404
There is no SJ customer with this personal identity number.
1.4 POST contracts/contract-number
Search for an SJ corporate contract by its corporate code.
Querystring parameters
None
Request body
{
“contractNumber”: “string”
}contractNumber
optionality: required
nullable: no
empty allowed: no
Example request
{
"contractNumber": "800183"
}Response body 200
A Contract object (see schema definitions)
Response body 404
There is no SJ corporate contract with this code.
2. Schema definitions
2.1 Customer
{
"firstName": "string",
"lastName": "string",
"memberNumber": "string",
"level": "string",
"email": "string",
"phoneNumber": "string",
"travelPasses": [
{
"cardNumber": "string",
"cardType": "string",
"description": "string",
"validFrom": "datetime",
"validTo": "datetime"
}
]
}Customer properties
| Name | JSON type | Domain type | Optionality | Nullable | Empty allowed |
|---|---|---|---|---|---|
| firstName | string | required | yes | ||
| lastName | string | required | yes | ||
| memberNumber | string | Prio card code | |||
| level | string | Prio level enum name | yes | ||
| string | email address | required | yes | ||
| phoneNumber | string | phone number | required | yes | |
| travelPasses | array | optional | yes |
Travel pass properties
| Name | JSON type | Domain type | Optionality | Nullable | Empty allowed | Comment |
|---|---|---|---|---|---|---|
| cardNumber | string | required | yes | |||
| cardType | string | required | yes | Example: SJ_ANNUAL_GOLD | ||
| description | string | required | yes | Example: "SJ Årskort Guld" | ||
| validFrom | string | required | yes | |||
| validTo | datetime | required | yes |
Example customer
{
"firstName": "Oscaro",
"lastName": "Carlssonf",
"memberNumber": "9752210236055741",
"level": " SJ_PRIO_BLACK",
"email": "oscaro.carlssonf.nosmsmfa@sjmail.se,
"phoneNumber": "+55504535306",
"travelPasses": [
{
"cardNumber": "9752209709109276",
"cardType": "SJ_ANNUAL_GOLD",
"description": "SJ Årskort Guld",
"validFrom": "2023-11-24",
"validTo": "2024-11-24"
}
]
} 2.2 Contract
{
"organizationName": "string",
"department": "string",
"contractNumber": "string",
"organizationNumber": "string"
}Contract properties
| Name | JSON type | Domain type | Optionality | Nullable | Empty allowed |
|---|---|---|---|---|---|
| organizationName | string | required | no | no | |
| department | string | required | yes | yes | |
| contractNumber | string | SJ corporate code | required | no | no |
| organizationNumber | string | required | no | no |
3. Miscellaneous
3.1 Authentication
Customer API uses the same authentication method as R-API, OAuth2 Client Credentials flow.
The client ID and client secret for R-API are also valid for Customer API.
3.2 Required headers
- Ocp-Apim-Subscription-Key
- Authorization header with Bearer token
- Requestor header is not needed.