Network Policy

Control outbound network access using DNS-based filtering. Policies define which domains sprites can reach, with support for exact matches, wildcard subdomains, and preset rule bundles.

Changes apply immediately—existing connections to newly-blocked domains are terminated. Failed DNS lookups return REFUSED for fast failure.

sprite-env

Network Policy

Get Network Policy

Get the current network policy configuration.

GET /sprites/{name}/policy/network

Response Body

application/json
rules* NetworkPolicyRule[]

List of network policy rules

domain? string

Domain pattern (e.g., *.github.com)

action? string

allow or deny

include? string

Include rules from preset

Response Codes

200

Success

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X GET \
  "https://api.sprites.dev/v1/sprites/{name}/policy/network" \
  -H "Authorization: Bearer $SPRITES_TOKEN"
200 Response
{
  "rules": [
    {
      "action": "allow",
      "domain": "github.com"
    },
    {
      "action": "allow",
      "domain": "*.npmjs.org"
    },
    {
      "action": "deny",
      "domain": "*"
    }
  ]
}

Network Policy

Set Network Policy

Update the network policy configuration.

POST /sprites/{name}/policy/network

Request Body

application/json
rules* NetworkPolicyRule[]

List of network policy rules

domain? string

Domain pattern (e.g., *.github.com)

action? string

allow or deny

include? string

Include rules from preset

Response Body

application/json

Response Codes

200

Success

400

Bad Request - Invalid request body

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X POST \
  "https://api.sprites.dev/v1/sprites/{name}/policy/network" \
  -H "Authorization: Bearer $SPRITES_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"rules":[{"action":"allow","domain":"github.com"},{"action":"allow","domain":"*.npmjs.org"}]}'
200 Response
{
  "rules": [
    {
      "action": "allow",
      "domain": "github.com"
    }
  ]
}

Network Policy

Get Privileges Policy

Get the current privileges policy configuration (capability and device restrictions).

GET /sprites/{name}/policy/privileges

Response Body

application/json

Response Codes

200

Success

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X GET \
  "https://api.sprites.dev/v1/sprites/{name}/policy/privileges" \
  -H "Authorization: Bearer $SPRITES_TOKEN"
200 Response

Network Policy

Set Privileges Policy

Update the privileges policy configuration to restrict capabilities or devices.

POST /sprites/{name}/policy/privileges

Response Body

application/json

Response Codes

200

Success

400

Bad Request - Invalid request body

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X POST \
  "https://api.sprites.dev/v1/sprites/{name}/policy/privileges" \
  -H "Authorization: Bearer $SPRITES_TOKEN"
200 Response

Network Policy

Delete Privileges Policy

Remove privileges policy to revert to default (unrestricted) behavior.

DELETE /sprites/{name}/policy/privileges

Response Body

application/json

Response Codes

200

Success

400

Bad Request - Invalid request body

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X DELETE \
  "https://api.sprites.dev/v1/sprites/{name}/policy/privileges" \
  -H "Authorization: Bearer $SPRITES_TOKEN"
200 Response

Network Policy

Get Resources Policy

Get the current resources policy configuration (memory limits).

GET /sprites/{name}/policy/resources

Response Body

application/json

Response Codes

200

Success

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X GET \
  "https://api.sprites.dev/v1/sprites/{name}/policy/resources" \
  -H "Authorization: Bearer $SPRITES_TOKEN"
200 Response

Network Policy

Set Resources Policy

Update the resources policy configuration to set memory limits.

POST /sprites/{name}/policy/resources

Response Body

application/json

Response Codes

200

Success

400

Bad Request - Invalid request body

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X POST \
  "https://api.sprites.dev/v1/sprites/{name}/policy/resources" \
  -H "Authorization: Bearer $SPRITES_TOKEN"
200 Response

Network Policy

Delete Resources Policy

Remove resources policy to revert to default behavior.

DELETE /sprites/{name}/policy/resources

Response Body

application/json

Response Codes

200

Success

400

Bad Request - Invalid request body

404

Not Found - Resource not found

500

Internal Server Error

bash
curl -X DELETE \
  "https://api.sprites.dev/v1/sprites/{name}/policy/resources" \
  -H "Authorization: Bearer $SPRITES_TOKEN"
200 Response