NAV
Shell HTTP JavaScript Node.js Ruby Python Java Go PHP

# Wekan REST API v5.05

> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

The REST API allows you to control and extend Wekan with ease.

If you are an end-user and not a dev or a tester, create an issue to request new APIs.

> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.

# Production Security Concerns

When calling a production Wekan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:

- Only call via HTTPS
- Implement a timed authorization token expiration strategy
- Ensure the calling user only has permissions for what they are calling and no more

# Authentication

- API Key (UserSecurity)
  - Parameter Name: Authorization, in: header.

# Login

> Code samples

    # You can also use wget
    curl -X POST /users/login \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -H 'Accept: */*'

    POST /users/login HTTP/1.1

    Content-Type: application/x-www-form-urlencoded
    Accept: */*

    const inputBody = '{
      "username": "string",
      "password": "pa$$word"
    }';
    const headers = {
      'Content-Type':'application/x-www-form-urlencoded',
      'Accept':'*/*'
    };

    fetch('/users/login',
    {
      method: 'POST',
      body: inputBody,
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });

    const fetch = require('node-fetch');
    const inputBody = {
      "username": "string",
      "password": "pa$$word"
    };
    const headers = {
      'Content-Type':'application/x-www-form-urlencoded',
      'Accept':'*/*'
    };

    fetch('/users/login',
    {
      method: 'POST',
      body: JSON.stringify(inputBody),
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });

    require 'rest-client'
    require 'json'

    headers = {
      'Content-Type' => 'application/x-www-form-urlencoded',
      'Accept' => '*/*'
    }

    result = RestClient.post '/users/login',
      params: {
      }, headers: headers

    p JSON.parse(result)

    import requests
    headers = {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Accept': '*/*'
    }

    r = requests.post('/users/login', headers = headers)

    print(r.json())

    URL obj = new URL("/users/login");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());

    package main

    import (
           "bytes"
           "net/http"
    )

    func main() {

        headers := map[string][]string{
            "Content-Type": []string{"application/x-www-form-urlencoded"},
            "Accept": []string{"*/*"},
        }

        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "/users/login", data)
        req.Header = headers

        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }

     'application/x-www-form-urlencoded',
        'Accept' => '*/*',
    );

    $client = new \GuzzleHttp\Client();

    // Define array of request body.
    $request_body = array();

    try {
        $response = $client->request('POST','/users/login', array(
            'headers' => $headers,
            'json' => $request_body,
           )
        );
        print_r($response->getBody()->getContents());
     }
     catch (\GuzzleHttp\Exception\BadResponseException $e) {
        // handle exception or api errors.
        print_r($e->getMessage());
     }

     // ...

`POST /users/login`

Login with REST API

> Body parameter

    username: string
    password: pa$$word

### Parameters

Name | In | Type | Required | Description
--- | --- | --- | --- | ---
body | body | object | true | none
» username | body | string | true | Your username
» password | body | string(password) | true | Your password

> Example responses

> 200 Response

### Responses

Status | Meaning | Description | Schema
--- | --- | --- | ---
200 | OK | Successful authentication | Inline
400 | Bad Request | Error in authentication | Inline
default | Default | Error in authentication | None

### Response Schema

Status Code 200

Name | Type | Required | Restrictions | Description
--- | --- | --- | --- | ---
» id | string | false | none | none
» token | string | false | none | none
» tokenExpires | string | false | none | none

Status Code 400

Name | Type | Required | Restrictions | Description
--- | --- | --- | --- | ---
» error | number | false | none | none
» reason | string | false | none | none

This operation does not require authentication

## register

> Code samples

    # You can also use wget
    curl -X POST /users/register \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -H 'Accept: */*'

    POST /users/register HTTP/1.1

    Content-Type: application/x-www-form-urlencoded
    Accept: */*

    const inputBody = '{
      "username": "string",
      "password": "pa$$word",
      "email": "string"
    }';
    const headers = {
      'Content-Type':'application/x-www-form-urlencoded',
      'Accept':'*/*'
    };

    fetch('/users/register',
    {
      method: 'POST',
      body: inputBody,
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });

    const fetch = require('node-fetch');
    const inputBody = {
      "username": "string",
      "password": "pa$$word",
      "email": "string"
    };
    const headers = {
      'Content-Type':'application/x-www-form-urlencoded',
      'Accept':'*/*'
    };

    fetch('/users/register',
    {
      method: 'POST',
      body: JSON.stringify(inputBody),
      headers: headers
    })
    .then(function(res) {
        return res.json();
    }).then(function(body) {
        console.log(body);
    });

    require 'rest-client'
    require 'json'

    headers = {
      'Content-Type' => 'application/x-www-form-urlencoded',
      'Accept' => '*/*'
    }

    result = RestClient.post '/users/register',
      params: {
      }, headers: headers

    p JSON.parse(result)

    import requests
    headers = {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Accept': '*/*'
    }

    r = requests.post('/users/register', headers = headers)

    print(r.json())

    URL obj = new URL("/users/register");
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    int responseCode = con.getResponseCode();
    BufferedReader in = new BufferedReader(
        new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    System.out.println(response.toString());

    package main

    import (
           "bytes"
           "net/http"
    )

    func main() {

        headers := map[string][]string{
            "Content-Type": []string{"application/x-www-form-urlencoded"},
            "Accept": []string{"*/*"},
        }

        data := bytes.NewBuffer([]byte{jsonReq})
        req, err := http.NewRequest("POST", "/users/register", data)
        req.Header = headers

        client := &http.Client{}
        resp, err := client.Do(req)
        // ...
    }

     'application/x-www-form-urlencoded',
        'Accept' => '*/*',
    );

    $client = new \GuzzleHttp\Client();

    // Define array of request body.
    $request_body = array();

    try {
        $response = $client->request('POST','/users/register', array(
            'headers' => $headers,
            'json' => $request_body,
           )
        );
        print_r($response->getBody()->getContents());
     }
     catch (\GuzzleHttp\Exception\BadResponseException $e) {
        // handle exception or api errors.
        print_r($e->getMessage());
     }

     // ...

`POST /users/register`

Register with REST API

Notes:

- You will need to provide the token for any of the authenticated methods.

> Body parameter

    username: string
    password: pa$$word
    email: string

### Parameters

Name | In | Type | Required | Description
--- | --- | --- | --- | ---
body | body | object | true | none
» username | body | string | true | Your username
» password | body | string(password) | true | Your password
» email | body | string | true | Your email

> Example responses

> 200 Response

### Responses

Status | Meaning | Description | Schema
--- | --- | --- | ---
200 | OK | Successful registration | Inline
400 | Bad Request | Error in registration | Inline
default | Default | Error in registration | None

### Response Schema

Status Code 200

Name | Type | Required | Restrictions | Description
--- | --- | --- | --- | ---
» id | string | false | none | none
» token | string | false | none | none
» tokenExpires | string | false | none | none

Status Code 400

Name | Type | Required | Restrictions | Description
--- | --- | --- | --- | ---
» error | number | false | none | none
» reason | string | false | none | none

This operation does not require authentication
Shell HTTP JavaScript Node.js Ruby Python Java Go PHP