Phone Numbers
Phone Numbers can be added to related objects like Profiles so that they can be used in use cases like 2FA, fraud prevention, and more.
Data Types
PhoneNumberResponse
PhoneNumberResponse Example
{
"data": {
"type": "phone-numbers",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"attributes": {
"number": "+12125551212",
"metadata": "{}",
"created-at": "2024-05-01T00:00:00Z",
"updated-at": "2024-05-01T00:00:00Z"
},
"relationships": {
"owner": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
}
}
}
}
CreatePhoneNumberRequest
Key | Value | |
---|---|---|
type | phone-numbers | Required |
Attributes | ||
number* | String | Required |
metadata | Metadata | |
Relationships | ||
owner | OwnerRelationship | Required |
number
must be in valid E.164 Format, ex: +12125551212
CreatePhoneNumberRequest Example
{
"data": {
"type": "phone-numbers",
"attributes": {
"number": "+12125551212",
"metadata": "{}"
},
"relationships": {
"owner": {
"data": {
"type": "profiles",
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0"
}
}
}
}
}
GET/v1/phone-numbers
List Phone Numbers
This endpoint retrieves a paginated list of Phone Numbers.
This endpoint returns an array of PhoneNumberResponse objects.
Filters
- Name
created_between
- Type
- object
- Description
- See documentation for filtering by timestamps.
- Name
updated_between
- Type
- object
- Description
- See documentation for filtering by timestamps.
- Name
metadata
- Type
- object
- Description
- See documentation for filtering by metadata.
- Name
page
- Type
- object
- Description
- See documentation for pagination.
Request
GET
/v1/phone-numbers curl --request GET \
--url 'https://api.opentransact.com/v1/phone-numbers' \
--header 'Authorization: Bearer {API_KEY}'
Response
{
"data": [
{
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"type": "phone-numbers",
"attributes": {
"number": "+12125551212",
"metadata": "{}",
"created-at": "2024-05-01T00:00:00Z",
"updated-at": "2024-05-01T00:00:00Z"
},
"relationships": {
"owner": {
"data": {
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"type": "profiles"
}
}
}
},
... // more phone numbers
],
"meta": {
"page-count": 2,
"count": 38,
"current-page": 1
},
"links": {
"self": "https://api.opentransact.com/v1/phone-numbers?page[number]=1&page[size]=50",
"first": "https://api.opentransact.com/v1/phone-numbers?page[number]=1&page[size]=50",
"last": "https://api.opentransact.com/v1/phone-numbers?page[number]=2&page[size]=50",
"next": "https://api.opentransact.com/v1/phone-numbers?page[number]=2&page[size]=50"
}
}
POST/v1/phone-numbers
Create a Phone Number
This endpoint creates a new Phone Number.
This endpoint accepts a CreatePhoneNumberRequest object and returns a PhoneNumberResponse object.
Request
POST
/v1/phone-numberscurl --request POST \
--url https://api.opentransact.com/v1/phone-numbers \
--header 'Authorization: Bearer {API_KEY}' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
"data":{
"type": "phone-numbers",
"attributes": {
"number": "+12125551212"
},
"relationships": {
"owner": {
"data": {
"type": "profiles",
"id": "{PROFILE_ID}"
}
}
}
}
}'
Response
{
"data": {
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"type": "phone-numbers",
"attributes": {
"number": "+12125551212",
"metadata": "{}",
"created-at": "2024-05-01T00:00:00Z",
"updated-at": "2024-05-01T00:00:00Z"
},
"relationships": {
"owner": {
"data": {
"id": "{PROFILE_ID}",
"type": "profiles"
}
}
}
}
}
GET/v1/phone-numbers/:id
Show a Phone Number
This endpoint retrieves a Phone Number by providing its ID.
This endpoint returns a PhoneNumberResponse object.
Request
GET
/v1/phone-numbers/SIuAFUNKdSYHZF2w curl --request GET \
--url https://api.opentransact.com/v1/phone-numbers/{PHONE_NUMBER_ID} \
--header 'Authorization: Bearer {API_KEY}'
Response
{
"data": {
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"type": "phone-numbers",
"attributes": {
"number": "+12125551212",
"metadata": "{}",
"created-at": "2024-05-01T00:00:00Z",
"updated-at": "2024-05-01T00:00:00Z"
},
"relationships": {
"owner": {
"data": {
"id": "4c72784e-fb2a-4858-8067-95b6e36d54c0",
"type": "profiles"
}
}
}
}
}