Quickstart
This guide will help you get started with the SIM Swap API. You will learn how to initialize the SDK, send a SIM Swap request, and handle the response.
Prerequisites
Before you begin, you need to have the following:
- subscribe to the SIM Swap service, (guide here)
Step 1: Get your API Credentials
To get your API Credentials, you can go to the SIM Swap Product Page and click on "Manage on Provider" to access the service dashboard. For a full guide on how to get your credentials, you can refer to the Registration guide.
Step 2: Create a new project
Create a new folder and enter the folder from a terminal.
mkdir sim-swap-test
cd sim-swap-test
go mod init sim-swap-test
Step 3: Initialize the SDK
go get github.com/GlideApis/sdk-go
Step 4: Send a SIM Swap request
Create a new file main.go
and initialize the SDK with your API credentials.
main.go
package main
import (
"github.com/GlideApis/sdk-go/pkg/glide"
"github.com/GlideApis/sdk-go/pkg/types"
"fmt"
)
func main() {
client, err := glide.NewGlideClient(types.GlideSdkSettings{
ClientID: "<client_id>",
ClientSecret: "<client_secret>",
})
if err != nil {
// handle error
return
}
userClient, err := client.SimSwap.For(types.PhoneIdentifier{
PhoneNumber: "+555123456789",
})
if err != nil {
// handle error
return
}
response, err := userClient.Check(types.SimSwapCheckParams{}, types.ApiConfig{})
if err != nil {
// handle error
return
}
fmt.Println("SIM swap check result:", response.Swapped)
}
To execute this you can the following from a terminal in the directory of your code:
go run main.go