---
id: create-a-route
title: "Create a Route"
description: "Creates a Route"
sidebar_label: "Create a Route"
hide_title: true
hide_table_of_contents: true
api: {"description":"Creates a Route","tags":["Routes"],"security":[{"BearerAuth":[]},{"TokenAuth":[]}],"requestBody":{"description":"New Routes request","content":{"application/json":{"schema":{"type":"object","properties":{"description":{"description":"Route description","type":"string"},"network_id":{"description":"Route network identifier, to group HA routes","type":"string","maxLength":40,"minLength":1},"enabled":{"description":"Route status","type":"boolean"},"peer":{"description":"Peer Identifier associated with route","type":"string"},"network":{"description":"Network range in CIDR format","type":"string"},"metric":{"description":"Route metric number. Lowest number has higher priority","type":"integer","maximum":9999,"minimum":1},"masquerade":{"description":"Indicate if peer should masquerade traffic to this route's prefix","type":"boolean"},"groups":{"description":"Route group tag groups","type":"array","items":{"type":"string"}}},"required":["id","description","network_id","enabled","peer","network","metric","masquerade","groups"],"title":"RouteRequest"}}}},"responses":{"200":{"description":"A Route Object","content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"id":{"description":"Route Id","type":"string"},"network_type":{"description":"Network type indicating if it is IPv4 or IPv6","type":"string"}},"required":["id","network_type"]},{"type":"object","properties":{"description":{"description":"Route description","type":"string"},"network_id":{"description":"Route network identifier, to group HA routes","type":"string","maxLength":40,"minLength":1},"enabled":{"description":"Route status","type":"boolean"},"peer":{"description":"Peer Identifier associated with route","type":"string"},"network":{"description":"Network range in CIDR format","type":"string"},"metric":{"description":"Route metric number. Lowest number has higher priority","type":"integer","maximum":9999,"minimum":1},"masquerade":{"description":"Indicate if peer should masquerade traffic to this route's prefix","type":"boolean"},"groups":{"description":"Route group tag groups","type":"array","items":{"type":"string"}}},"required":["id","description","network_id","enabled","peer","network","metric","masquerade","groups"],"title":"RouteRequest"}],"title":"Route"}}}},"400":{"description":"Bad Request","content":{}},"401":{"description":"Requires authentication","content":{}},"403":{"description":"Forbidden","content":{}},"500":{"description":"Internal Server Error","content":{}}},"method":"post","path":"/api/routes","servers":[{"url":"https://netbird.io","description":"Default server"}],"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"TokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Prefix the value with \\\"Token\\\" to indicate the custom authorization type"}},"jsonRequestBodyExample":{"description":"string","network_id":"string","enabled":true,"peer":"string","network":"string","metric":0,"masquerade":true,"groups":["string"]},"info":{"title":"NetBird REST API","description":"API to manipulate groups, rules, policies and retrieve information about peers and users","version":"0.0.1"},"postman":{"name":"Create a Route","description":{"content":"Creates a Route","type":"text/plain"},"url":{"path":["api","routes"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}},"auth":{"type":"bearer","bearer":[{"type":"any","value":"<Bearer Token>","key":"token"}]}}}
sidebar_class_name: "post api-method"
info_path: api/netbird-rest-api
custom_edit_url: null
---

import ApiTabs from "@theme/ApiTabs";
import MimeTabs from "@theme/MimeTabs";
import ParamsItem from "@theme/ParamsItem";
import ResponseSamples from "@theme/ResponseSamples";
import SchemaItem from "@theme/SchemaItem";
import SchemaTabs from "@theme/SchemaTabs";
import DiscriminatorTabs from "@theme/DiscriminatorTabs";
import TabItem from "@theme/TabItem";

## Create a Route



Creates a Route

<MimeTabs><TabItem label={"application/json"} value={"application/json-schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Request Body</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}><div style={{"marginTop":"1rem","marginBottom":"1rem"}}>

New Routes request

</div></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"description"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Route description","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"network_id"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** `non-empty` and `<= 40 characters`"} schema={{"description":"Route network identifier, to group HA routes","type":"string","maxLength":40,"minLength":1}}></SchemaItem><SchemaItem collapsible={false} name={"enabled"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Route status","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"peer"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer Identifier associated with route","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"network"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Network range in CIDR format","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"metric"} required={true} schemaName={"integer"} qualifierMessage={"**Possible values:** `>= 1` and `<= 9999`"} schema={{"description":"Route metric number. Lowest number has higher priority","type":"integer","maximum":9999,"minimum":1}}></SchemaItem><SchemaItem collapsible={false} name={"masquerade"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Indicate if peer should masquerade traffic to this route's prefix","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"groups"} required={true} schemaName={"string[]"} qualifierMessage={undefined} schema={{"description":"Route group tag groups","type":"array","items":{"type":"string"}}}></SchemaItem></ul></details></TabItem></MimeTabs><div><ApiTabs><TabItem label={"200"} value={"200"}><div>

A Route Object

</div><div><MimeTabs schemaType={"response"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs><TabItem label={"Schema"} value={"Schema"}><details style={{}} data-collapsed={false} open={true}><summary style={{"textAlign":"left"}}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}><SchemaItem collapsible={false} name={"id"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Route Id","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"network_type"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Network type indicating if it is IPv4 or IPv6","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"description"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Route description","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"network_id"} required={true} schemaName={"string"} qualifierMessage={"**Possible values:** `non-empty` and `<= 40 characters`"} schema={{"description":"Route network identifier, to group HA routes","type":"string","maxLength":40,"minLength":1}}></SchemaItem><SchemaItem collapsible={false} name={"enabled"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Route status","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"peer"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Peer Identifier associated with route","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"network"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"description":"Network range in CIDR format","type":"string"}}></SchemaItem><SchemaItem collapsible={false} name={"metric"} required={true} schemaName={"integer"} qualifierMessage={"**Possible values:** `>= 1` and `<= 9999`"} schema={{"description":"Route metric number. Lowest number has higher priority","type":"integer","maximum":9999,"minimum":1}}></SchemaItem><SchemaItem collapsible={false} name={"masquerade"} required={true} schemaName={"boolean"} qualifierMessage={undefined} schema={{"description":"Indicate if peer should masquerade traffic to this route's prefix","type":"boolean"}}></SchemaItem><SchemaItem collapsible={false} name={"groups"} required={true} schemaName={"string[]"} qualifierMessage={undefined} schema={{"description":"Route group tag groups","type":"array","items":{"type":"string"}}}></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n  \"id\": \"string\",\n  \"network_type\": \"string\",\n  \"description\": \"string\",\n  \"network_id\": \"string\",\n  \"enabled\": true,\n  \"peer\": \"string\",\n  \"network\": \"string\",\n  \"metric\": 0,\n  \"masquerade\": true,\n  \"groups\": [\n    \"string\"\n  ]\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"400"} value={"400"}><div>

Bad Request

</div><div></div></TabItem><TabItem label={"401"} value={"401"}><div>

Requires authentication

</div><div></div></TabItem><TabItem label={"403"} value={"403"}><div>

Forbidden

</div><div></div></TabItem><TabItem label={"500"} value={"500"}><div>

Internal Server Error

</div><div></div></TabItem></ApiTabs></div>
      