Creating Subprojects
Subprojects are a way for you to have more control over the resources (e.g., phone numbers or tokens) assigned to your own customers, by separating them into different containers which you can control programmatically via our APIs.
All subprojects will share balance and usage limits with your main account. However, any rooms, recordings, phone numbers, SIP endpoints, and so on, will only be visible from their own subproject.
If you delete a subproject, all and only the resources belonging to that subproject are removed.
Creating a subproject from the UI
Login to your SignalWire Space. From the left menu, click on "Home". Then, select the "Subprojects" tab. You will now be able to create subprojects for the project you're currently in.
Creating a subproject using the REST APIs
The main power of subprojects comes from the ability of automation. For example, you can create a subproject using the REST APIs as in the following example:
- Shell
- Node.js
curl -X POST https://$SIGNALWIRE_SPACE.signalwire.com/api/laml/2010-04-01/Accounts.json \
--data-urlencode "FriendlyName=MyFirstSubproject" \
-u $SIGNALWIRE_PROJECT_ID:$SIGNALWIRE_API_TOKEN
const axios = require("axios");
const url = require("url");
const params = new url.URLSearchParams({ FriendlyName: "MyFirstSubproject" });
axios.post(
"https://SIGNALWIRE_SPACE.signalwire.com/api/laml/2010-04-01/Accounts.json",
params.toString(),
{
auth: {
username: "SIGNALWIRE_PROJECT_ID",
password: "SIGNALWIRE_API_TOKEN",
},
}
);
If successful, the reply from the server will include information about the subproject that has just been created:
{
"sid": "c42ea358-...4bc3",
"friendly_name": "MyFirstSubproject",
"status": "active",
"auth_token": "redacted",
"date_created": "Tue, 11 Jan 2022 11:45:53 +0000",
"date_updated": "Tue, 11 Jan 2022 11:45:53 +0000",
"type": "Full",
"owner_account_sid": "7bfc11e6-...4eee",
"uri": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3",
"subresource_uris": {
"addresses": null,
"available_phone_numbers": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/AvailablePhoneNumbers",
"applications": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/Applications",
"authorized_connect_apps": null,
"calls": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/Calls",
"conferences": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/Conferences",
"connect_apps": null,
"incoming_phone_numbers": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/IncomingPhoneNumbers",
"keys": null,
"notifications": null,
"outgoing_caller_ids": null,
"queues": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/Queues",
"recordings": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/Recordings",
"sandbox": null,
"signing_keys": null,
"sip": null,
"short_codes": null,
"messages": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/Messages",
"transcriptions": "/api/laml/2010-04-01/Accounts/c42ea358-...4bc3/Transcriptions",
"usage": null
}
}
You can do much more through the REST APIs. For example, you can list subprojects or exchange phone numbers between them. Find more by exploring our REST API Reference.