Skip to main content
POST
/
workspace
/
{workspace_id}
/
apigroup
/
{apigroup_id}
/
api
Create a new API endpoint using XanoScript
curl --request POST \
  --url https://x8ki-letl-twmt.n7.xano.io/api:meta/workspace/{workspace_id}/apigroup/{apigroup_id}/api \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: text/x-xanoscript' \
  --data 'query foo verb=GET {
  input {
    int score
  }
  stack {
    var $x1 {
      value = $input.score + 1
    }
  }
  response {
    value = $x1
  }
}
'
{
  "id": 1,
  "created_at": "2023-04-19 21:01:32+0000",
  "updated_at": "2023-04-19 21:01:32+0000",
  "name": "API Test",
  "description": "My APIs description",
  "docs": "Documentation",
  "guid": "YE1fwVhQ-enRlc6Sb42Gqru58-0",
  "cache": {
    "active": true,
    "ttl": 3600,
    "input": true,
    "auth": true,
    "datasource": true,
    "ip": true,
    "headers": [
      ""
    ],
    "env": [
      "<string>"
    ]
  },
  "auth": {},
  "verb": "GET",
  "input": [
    ""
  ],
  "tag": [
    "example tag"
  ],
  "xanoscript": {
    "status": "ok",
    "value": "<string>",
    "message": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workspace_id
integer
required
apigroup_id
integer
required

Query Parameters

branch
string
default:""

Body

The body is of type string.

Example:

"query foo verb=GET {\n input {\n int score\n }\n stack {\n var $x1 {\n value = $input.score + 1\n }\n }\n response {\n value = $x1\n }\n}\n"

Response

Success!

id
integer
default:1
created_at
string<timestamptz>
default:2023-04-19 21:01:32+0000
updated_at
string<timestamptz>
default:2023-04-19 21:01:32+0000
name
string
default:API Test
description
string
default:My APIs description
docs
string
default:Documentation
guid
string
default:YE1fwVhQ-enRlc6Sb42Gqru58-0
cache
object
auth
object
verb
enum<string>
default:GET
Available options:
GET,
POST,
DELETE,
PUT,
PATCH,
HEAD
input
object[]
tag
string[]
xanoscript
object
I