--- 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":"","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
Request Body
New Routes request
    = 1` and `<= 9999`"} schema={{"description":"Route metric number. Lowest number has higher priority","type":"integer","maximum":9999,"minimum":1}}>
A Route Object
Schema
    = 1` and `<= 9999`"} schema={{"description":"Route metric number. Lowest number has higher priority","type":"integer","maximum":9999,"minimum":1}}>
Bad Request
Requires authentication
Forbidden
Internal Server Error