Getting Started
Let's get started with Network as Code! This quick-start guide will help you create an account, get your application keys, and set up your development environment, so that you can get a feel for programmable mobile networks.
Initial setup
Create your account
Sign up to the platform through the Network as Code Dashboard.
Get your first API key
Please, be careful with your API keys. Treat them like secrets or passwords. Do not commit them to Git or show them publicly anywhere. Stolen API keys may be used for malicious purposes and can cause harm in the wrong hands.
-
Head over to your Dashboard. Log in, if not yet logged in.
-
Click on Console in the top navbar. You will be presented with your applications, including a default application that is automatically created for you.
-
Click open one of the applications.
-
The API keys for the application will be visible. View, copy, delete or add API keys as needed.
Creating your first Network as Code project
Python setup
Prerequisites
Create a new Python project
Open a terminal window and create a new directory for your project. Let's call it nac-hello-world.
mkdir nac-hello-world
Then, move into this newly created directory, create a virtual environment called env, then activate it.
NOTE: Make sure your Python version is 3.11 or higher.
cd nac-hello-world
python3 -m venv env
source env/bin/activateInstall the Network as Code SDK
Let's install the latest version of the Network as Code SDK for Python.
NOTE: Make sure your Python version is 3.11 or higher.
pip install network_as_code
TypeScript setup
Prerequisites
Create a new TypeScript project
Open a terminal window and create a new directory for your project. Let's call it nac-hello-world.
mkdir nac-hello-world
Move into the newly created project directory and initialize a new TypeScript project.
cd nac-hello-world
npm init
Install TypeScript and Network as Code SDK
Install TypeScript and Network as Code as dependencies.
npm i typescript --save-dev
npm i network-as-code
Configure TypeScript
Run the following command to create a tsconfig.json file.
npx tsc --init
Open the tsconfig.json file and make sure its module and target section are set to esnext.
Make your first Network as Code program
Open the project directory (nac-hello-world) in your favorite code editor,
such as Visual Studio Code, Emacs, or Vim and create a file called main with the
file extension for the programming language you are using, for example main.py or main.ts.
Copy one of the following code-snippet example into main:
import network_as_code as nac
# We begin by creating a Network as Code client
client = nac.NetworkAsCodeClient(
token="<your-application-key-here>"
)Replace the <your-application-key-here> with the API key you copied earlier from your
Dashboard.
What does this code do? It creates a new NetworkAsCodeClient object which will store your application key.
The NetworkAsCodeClient is the entry-point to all the functionality Network as Code provides.
Creating a test device ID
Authorization: Network as Code allows querying any device for its location, modify its network parameters, find out whether it's connected to the Internet or not and so on. However, you can only perform these actions against devices you are authorized to use. This does not apply to simulated test-devices. Read our Consent and identity management policy carefully.
In order to use the simulators attached to our APIs, you need to use specific kinds of device identifiers. Network as Code uses certain patterns to determine whether to route to a simulator or to a real network.
Devices can be identified either with a network access identifier or a
phone number. For network access identifiers the simulators use an
email-like format of [device-name]@testcsp.net. You can, for
example, use [email protected] as a test device network
access identifier.
If you would prefer to use a phone number instead, the important thing
is to use a simulator phone number prefix. The valid prefixes are
+3672,+3670 and '3637. You then just pick the rest of the digits
freely. For example, you could decide on +3672123456 as a test device
phone number.
If you'd like to know more about identifying devices, you can read about it on our Identifying mobile network devices page.
Trying out a Quality-of-service on Demand session
Quality-of-service on Demand (QoD) allows simple management of a device's bandwidth and latency, among other quality of service parameters.
With our project skeleton ready the next step is to try creating a QoD session for a simulated device: Create your first QoD session.
What's next?
You've now set up everything you need to use Network as Code and had a quick taste of how it is used to program networks. Feel free to browse our growing catalog of features to learn more!
Check out our documentation for the following features:
- Device Location
- Device Status
- Consent and identity management
- Network Insights
- Network Slicing
- Quality-of-service on Demand sessions
- SIM Swap
- Number Verification
We hope you enjoy using Network as Code!
Last updated November 05, 2025