Skip to main content
POST
/
facts
cURL
curl --request POST \
  --url https://api.osohq.com/api/facts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "predicate": "<string>",
  "args": [
    {
      "type": "<string>",
      "id": "<string>"
    }
  ]
}
'
import os
from oso_cloud import Oso, Value

oso = Oso(api_key=os.environ.get('OSO_CLOUD_API_KEY', None))

# Insert a single fact
user = Value("User", "alice")
repo = Value("Repository", "anvils")
oso.insert(("has_role", user, "maintainer", repo))
import { Oso } from 'oso-cloud';

const apiKey = process.env.OSO_CLOUD_API_KEY;
const oso = new Oso("https://cloud.osohq.com", apiKey);

// Insert a single fact
await oso.insert([
"has_role",
{ type: "User", id: "alice" },
"maintainer",
{ type: "Repository", id: "anvils" }
]);
package main

import (
"log"
"os"
oso "github.com/osohq/go-oso-cloud/v2"
)

func main() {
apiKey := os.Getenv("OSO_CLOUD_API_KEY")
osoClient := oso.NewClient("https://cloud.osohq.com", apiKey)

// Insert a single fact
alice := oso.NewValue("User", "alice")
repo := oso.NewValue("Repository", "anvils")
err := osoClient.Insert(oso.NewFact("has_role", alice, oso.String("maintainer"), repo))
if err != nil {
log.Fatal(err)
}
}
package com.mycompany;

import java.io.IOException;
import com.osohq.oso_cloud.Oso;
import com.osohq.oso_cloud.api.ApiException;
import com.osohq.oso_cloud.api.Value;

public class App {
public static void main(String[] args) {
String apiKey = System.getenv("OSO_CLOUD_API_KEY");
Oso oso = new Oso(apiKey);

try {
// Insert a single fact
Value user = new Value("User", "alice");
Value repo = new Value("Repository", "anvils");
oso.insert("has_role", user, "maintainer", repo);
} catch (IOException | ApiException e) {
System.err.println("Error: " + e.getMessage());
}
}
}
require 'oso-cloud'

api_key = ENV.fetch('OSO_CLOUD_API_KEY', nil)
oso = OsoCloud::Oso.new(url: "https://cloud.osohq.com", api_key: api_key)

# Insert a single fact
user = OsoCloud::Value.new(type: "User", id: "alice")
repo = OsoCloud::Value.new(type: "Repository", id: "anvils")
oso.tell("has_role", user, "maintainer", repo)
using OsoCloud;

string? apiKey = Environment.GetEnvironmentVariable("OSO_CLOUD_API_KEY");
var oso = new Oso("https://api.osohq.com", apiKey);

// Insert a single fact
var user = new Value("User", "alice");
var repo = new Value("Repository", "anvils");
await oso.Insert("has_role", user, "maintainer", repo);
{
  "predicate": "<string>",
  "args": [
    {
      "type": "<string>",
      "id": "<string>"
    }
  ]
}
{
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Requires an API key to access.

Body

application/json

A pattern object for matching authorization-relevant data, ie: facts.

predicate
string
required
args
object[]
required

Response

A pattern object for matching authorization-relevant data, ie: facts.

predicate
string
required
args
object[]
required