curl -sS -X POST 'https://apipub.firstbasehq.com/api/v1/replacements' \
-H 'Authorization: ApiKey YOUR_API_KEY' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"returnItems": [
{
"inventoryId": "123e4567-e89b-12d3-a456-426614174000",
"serialNumber": "SN-12345"
}
],
"order": {
"skus": [
{
"id": "123e4567-e89b-12d3-a456-426614174000"
}
],
"shippingAddress": {
"addressLine1": 123,
"addressLine2": "Apartment B",
"city": "San Francisco",
"state": "California",
"zipCode": 94158,
"country": "US",
"phoneNumber": "+1-555-123-4567"
}
},
"returnKitAddress": {
"addressLine1": 123,
"addressLine2": "Apartment B",
"city": "San Francisco",
"state": "California",
"zipCode": 94158,
"country": "US",
"phoneNumber": "+1-555-123-4567"
}
}'import requests
url = "https://apipub.firstbasehq.com/api/v1/replacements"
payload = {
"returnItems": [
{
"inventoryId": "123e4567-e89b-12d3-a456-426614174000",
"serialNumber": "SN-12345"
}
],
"order": {
"skus": [{ "id": "123e4567-e89b-12d3-a456-426614174000" }],
"shippingAddress": {
"addressLine1": 123,
"addressLine2": "Apartment B",
"city": "San Francisco",
"state": "California",
"zipCode": 94158,
"country": "US",
"phoneNumber": "+1-555-123-4567"
}
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
returnItems: [
{inventoryId: '123e4567-e89b-12d3-a456-426614174000', serialNumber: 'SN-12345'}
],
order: {
skus: [{id: '123e4567-e89b-12d3-a456-426614174000'}],
shippingAddress: {
addressLine1: 123,
addressLine2: 'Apartment B',
city: 'San Francisco',
state: 'California',
zipCode: 94158,
country: 'US',
phoneNumber: '+1-555-123-4567'
}
}
})
};
fetch('https://apipub.firstbasehq.com/api/v1/replacements', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "SUBMITTED",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"returnOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"errors": [
{
"detail": "Invalid request",
"source": "request"
}
]
}{
"errors": [
{
"detail": "Invalid request",
"source": "request"
}
]
}{
"errors": [
{
"detail": "Invalid request",
"source": "request"
}
]
}Create replacement
Creates a replacement consisting of a return order and a new equipment order
curl -sS -X POST 'https://apipub.firstbasehq.com/api/v1/replacements' \
-H 'Authorization: ApiKey YOUR_API_KEY' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"returnItems": [
{
"inventoryId": "123e4567-e89b-12d3-a456-426614174000",
"serialNumber": "SN-12345"
}
],
"order": {
"skus": [
{
"id": "123e4567-e89b-12d3-a456-426614174000"
}
],
"shippingAddress": {
"addressLine1": 123,
"addressLine2": "Apartment B",
"city": "San Francisco",
"state": "California",
"zipCode": 94158,
"country": "US",
"phoneNumber": "+1-555-123-4567"
}
},
"returnKitAddress": {
"addressLine1": 123,
"addressLine2": "Apartment B",
"city": "San Francisco",
"state": "California",
"zipCode": 94158,
"country": "US",
"phoneNumber": "+1-555-123-4567"
}
}'import requests
url = "https://apipub.firstbasehq.com/api/v1/replacements"
payload = {
"returnItems": [
{
"inventoryId": "123e4567-e89b-12d3-a456-426614174000",
"serialNumber": "SN-12345"
}
],
"order": {
"skus": [{ "id": "123e4567-e89b-12d3-a456-426614174000" }],
"shippingAddress": {
"addressLine1": 123,
"addressLine2": "Apartment B",
"city": "San Francisco",
"state": "California",
"zipCode": 94158,
"country": "US",
"phoneNumber": "+1-555-123-4567"
}
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
returnItems: [
{inventoryId: '123e4567-e89b-12d3-a456-426614174000', serialNumber: 'SN-12345'}
],
order: {
skus: [{id: '123e4567-e89b-12d3-a456-426614174000'}],
shippingAddress: {
addressLine1: 123,
addressLine2: 'Apartment B',
city: 'San Francisco',
state: 'California',
zipCode: 94158,
country: 'US',
phoneNumber: '+1-555-123-4567'
}
}
})
};
fetch('https://apipub.firstbasehq.com/api/v1/replacements', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "SUBMITTED",
"orderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"returnOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"errors": [
{
"detail": "Invalid request",
"source": "request"
}
]
}{
"errors": [
{
"detail": "Invalid request",
"source": "request"
}
]
}{
"errors": [
{
"detail": "Invalid request",
"source": "request"
}
]
}Authorizations
Prefix the value with "ApiKey" to indicate the custom authorization type
Body
Request to create a replacement (return + new order)
ID of the person whose equipment is being replaced
Items to return as part of the replacement
1Show child attributes
Show child attributes
The replacement order details (new equipment)
Show child attributes
Show child attributes
Whether to request address confirmation from the person before shipping the return kit
Address for the return kit shipment. Required when requestAddressConfirmation is false (the default). Omit only when requestAddressConfirmation is true, in which case the person is prompted to confirm their address before the kit ships. If omitted and requestAddressConfirmation is false, the order's shipping address is used.
Show child attributes
Show child attributes
Office ID for office returns. When set, items are returned to the office via SHIPMENT
Response
Replacement created
Response after creating a replacement