POST
/
api
/
oauth
/
consent
Consent
curl --request POST \
  --url https://api.costmcp.com/api/oauth/consent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "client_id": "<string>",
  "redirect_uri": "<string>",
  "code_challenge": "<string>",
  "workspace_id": "<string>",
  "code_challenge_method": "<string>",
  "scope": "<string>",
  "state": "<string>",
  "resource": "<string>"
}
'
import requests

url = "https://api.costmcp.com/api/oauth/consent"

payload = {
"client_id": "<string>",
"redirect_uri": "<string>",
"code_challenge": "<string>",
"workspace_id": "<string>",
"code_challenge_method": "<string>",
"scope": "<string>",
"state": "<string>",
"resource": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_id: '<string>',
redirect_uri: '<string>',
code_challenge: '<string>',
workspace_id: '<string>',
code_challenge_method: '<string>',
scope: '<string>',
state: '<string>',
resource: '<string>'
})
};

fetch('https://api.costmcp.com/api/oauth/consent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.costmcp.com/api/oauth/consent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client_id' => '<string>',
'redirect_uri' => '<string>',
'code_challenge' => '<string>',
'workspace_id' => '<string>',
'code_challenge_method' => '<string>',
'scope' => '<string>',
'state' => '<string>',
'resource' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.costmcp.com/api/oauth/consent"

payload := strings.NewReader("{\n \"client_id\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"workspace_id\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\",\n \"resource\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.costmcp.com/api/oauth/consent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_id\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"workspace_id\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\",\n \"resource\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.costmcp.com/api/oauth/consent")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_id\": \"<string>\",\n \"redirect_uri\": \"<string>\",\n \"code_challenge\": \"<string>\",\n \"workspace_id\": \"<string>\",\n \"code_challenge_method\": \"<string>\",\n \"scope\": \"<string>\",\n \"state\": \"<string>\",\n \"resource\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
Requires Supabase user JWT. Called by the web consent screen after login.
client_id
string
required
OAuth client ID
redirect_uri
string
required
Must match authorize request
code_challenge
string
required
PKCE challenge
workspace_id
string
required
UUID of workspace to grant
code_challenge_method
string
Default / expected S256
scope
string
Filtered to known scopes; defaults to all four
state
string
Echoed to client
resource
string
Resource indicator
200: { "redirect": "<redirect_uri>?code=...&state=..." } Auth codes expire in 5 minutes.
StatusMeaning
400Validation
403Not a workspace member
500Server error