cURL
curl --request PUT \
--url https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"permissions": [
"<string>"
],
"constraints": {
"credits:transfer": {
"allowed_recipient_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"allowed_source_types": [
"<string>"
],
"max_amount_per_transfer": 1,
"max_total_amount": 1
}
}
}
'import requests
url = "https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}"
payload = {
"expires_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"permissions": ["<string>"],
"constraints": { "credits:transfer": {
"allowed_recipient_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"allowed_source_types": ["<string>"],
"max_amount_per_transfer": 1,
"max_total_amount": 1
} }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expires_at: '2023-11-07T05:31:56Z',
name: '<string>',
permissions: ['<string>'],
constraints: {
'credits:transfer': {
allowed_recipient_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
allowed_source_types: ['<string>'],
max_amount_per_transfer: 1,
max_total_amount: 1
}
}
})
};
fetch('https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}', 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://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => '2023-11-07T05:31:56Z',
'name' => '<string>',
'permissions' => [
'<string>'
],
'constraints' => [
'credits:transfer' => [
'allowed_recipient_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'allowed_source_types' => [
'<string>'
],
'max_amount_per_transfer' => 1,
'max_total_amount' => 1
]
]
]),
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://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}"
payload := strings.NewReader("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"name\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"credits:transfer\": {\n \"allowed_recipient_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"allowed_source_types\": [\n \"<string>\"\n ],\n \"max_amount_per_transfer\": 1,\n \"max_total_amount\": 1\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"name\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"credits:transfer\": {\n \"allowed_recipient_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"allowed_source_types\": [\n \"<string>\"\n ],\n \"max_amount_per_transfer\": 1,\n \"max_total_amount\": 1\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"name\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"credits:transfer\": {\n \"allowed_recipient_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"allowed_source_types\": [\n \"<string>\"\n ],\n \"max_amount_per_transfer\": 1,\n \"max_total_amount\": 1\n }\n }\n}"
response = http.request(request)
puts response.read_bodyOrganization credentials
Put v1organizations credentials
deprecated
Deprecated: this endpoint is moving to cloud-platform at the same path; the cloud-platform base URL will be announced. Behaviour may differ in edge cases.
PUT
/
v1
/
organizations
/
{org_id}
/
credentials
/
{id}
cURL
curl --request PUT \
--url https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"permissions": [
"<string>"
],
"constraints": {
"credits:transfer": {
"allowed_recipient_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"allowed_source_types": [
"<string>"
],
"max_amount_per_transfer": 1,
"max_total_amount": 1
}
}
}
'import requests
url = "https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}"
payload = {
"expires_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"permissions": ["<string>"],
"constraints": { "credits:transfer": {
"allowed_recipient_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"allowed_source_types": ["<string>"],
"max_amount_per_transfer": 1,
"max_total_amount": 1
} }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
expires_at: '2023-11-07T05:31:56Z',
name: '<string>',
permissions: ['<string>'],
constraints: {
'credits:transfer': {
allowed_recipient_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
allowed_source_types: ['<string>'],
max_amount_per_transfer: 1,
max_total_amount: 1
}
}
})
};
fetch('https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}', 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://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => '2023-11-07T05:31:56Z',
'name' => '<string>',
'permissions' => [
'<string>'
],
'constraints' => [
'credits:transfer' => [
'allowed_recipient_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'allowed_source_types' => [
'<string>'
],
'max_amount_per_transfer' => 1,
'max_total_amount' => 1
]
]
]),
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://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}"
payload := strings.NewReader("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"name\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"credits:transfer\": {\n \"allowed_recipient_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"allowed_source_types\": [\n \"<string>\"\n ],\n \"max_amount_per_transfer\": 1,\n \"max_total_amount\": 1\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"name\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"credits:transfer\": {\n \"allowed_recipient_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"allowed_source_types\": [\n \"<string>\"\n ],\n \"max_amount_per_transfer\": 1,\n \"max_total_amount\": 1\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cloud-api.near.ai/v1/organizations/{org_id}/credentials/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"name\": \"<string>\",\n \"permissions\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"credits:transfer\": {\n \"allowed_recipient_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"allowed_source_types\": [\n \"<string>\"\n ],\n \"max_amount_per_transfer\": 1,\n \"max_total_amount\": 1\n }\n }\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
application/json
Response
200 - application/json
Replace configuration; lifetime usage is preserved