EQTY LabDocs

Create declaration on a control

Create a declaration for a specific control and return the persisted record

posthttps://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations
bash
curl --request POST \
  --url 'https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"extra":{"key":"string"},"isReadyForReview":true,"statement":"string","subjectLine":"string","submittedBy":"string"}'
javascript
const response = await fetch("https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "extra": {
      "key": "string"
    },
    "isReadyForReview": true,
    "statement": "string",
    "subjectLine": "string",
    "submittedBy": "string"
  })
});

const data = await response.json();
typescript
interface Declaration {
  appliedPolicyControlId?: number;
  attachmentCid?: string[];
  cid?: string;
  createdAt?: string;
  extra?: Record<string, unknown>;
  fileAttachments?: Record<string, unknown>[];
  id?: number;
  isAutomated?: boolean;
  isReadyForReview?: boolean;
  statement?: string;
  subjectLine?: string;
  submittedAt?: string;
  submittedBy?: string;
  submittedByDid?: string;
  updatedAt?: string;
}

const response = await fetch("https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "extra": {
      "key": "string"
    },
    "isReadyForReview": true,
    "statement": "string",
    "subjectLine": "string",
    "submittedBy": "string"
  })
});
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);

const data: Declaration = await response.json();
python
import requests

response = requests.post(
    "https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations",
    headers={
        "Authorization": "Bearer <token>",
        "Content-Type": "application/json",
    },
    json={
        "extra": {
            "key": "string",
        },
        "isReadyForReview": True,
        "statement": "string",
        "subjectLine": "string",
        "submittedBy": "string",
    },
)
response.raise_for_status()
print(response.json())
go
package main

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

func main() {
	body := strings.NewReader(`{
	  "extra": {
	    "key": "string"
	  },
	  "isReadyForReview": true,
	  "statement": "string",
	  "subjectLine": "string",
	  "submittedBy": "string"
	}`)
	req, err := http.NewRequest(http.MethodPost, "https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer <token>")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, err := io.ReadAll(res.Body)
	if err != nil {
		panic(err)
	}
	fmt.Println(res.Status, string(data))
}
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .method("POST", HttpRequest.BodyPublishers.ofString("""
                {
                  "extra": {
                    "key": "string"
                  },
                  "isReadyForReview": true,
                  "statement": "string",
                  "subjectLine": "string",
                  "submittedBy": "string"
                }
                """))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}
csharp
using System.Net.Http.Headers;
using System.Text;

using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "<token>");
request.Content = new StringContent("""
    {
      "extra": {
        "key": "string"
      },
      "isReadyForReview": true,
      "statement": "string",
      "subjectLine": "string",
      "submittedBy": "string"
    }
    """, Encoding.UTF8, "application/json");

using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");
php
<?php

$ch = curl_init('https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer <token>',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => <<<'JSON'
    {
      "extra": {
        "key": "string"
      },
      "isReadyForReview": true,
      "statement": "string",
      "subjectLine": "string",
      "submittedBy": "string"
    }
    JSON,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status . " " . $response . PHP_EOL;
ruby
require "net/http"

uri = URI("https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = <<~'JSON'
  {
    "extra": {
      "key": "string"
    },
    "isReadyForReview": true,
    "statement": "string",
    "subjectLine": "string",
    "submittedBy": "string"
  }
JSON

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
puts "#{response.code} #{response.body}"
rust
// Cargo.toml dependencies: reqwest (features "json"), serde_json, tokio (features "full")
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let response = reqwest::Client::new()
        .post("https://localhost:10001/api/v1/projects/{projectId}/policies/{appliedPolicyId}/controls/{appliedPolicyControlId}/declarations")
        .header("Authorization", "Bearer <token>")
        .json(&json!({
            "extra": {
                "key": "string"
            },
            "isReadyForReview": true,
            "statement": "string",
            "subjectLine": "string",
            "submittedBy": "string"
        }))
        .send()
        .await?;

    println!("{} {}", response.status(), response.text().await?);
    Ok(())
}

Authorizations

  • BearerAuth · API key in header "Authorization" — Type "Bearer" followed by a space and JWT token.

Parameters

Path parameters

NameTypeDescription
projectId
required
string

Project ID, UUID (urn:uuid optional), or slug:my-project

appliedPolicyId
required
string

Applied policy ID, slug:my-policy, or urn:cid:bafy...

appliedPolicyControlId
required
string

Applied policy control ID, code:AC-1, or urn:cid:bafy...

Request bodyrequired

Declaration data

application/json
  • extraobject

    Hashed into the CID; not stored

    Show properties

    Map of string

  • isReadyForReviewboolean

    Needs submit_controls_for_review

  • statementstring
  • subjectLinestring
  • submittedBystring

    Defaults to the caller identity

Examplejson
{
  "extra": {
    "key": "string"
  },
  "isReadyForReview": true,
  "statement": "string",
  "subjectLine": "string",
  "submittedBy": "string"
}

Responses

201Created declaration

application/json
  • appliedPolicyControlIdintegerread-only

    Taken from the path on create

  • attachmentCidstring[]read-only

    Derived from the uploaded bytes; not stored

  • cidstringread-only

    Assigned by the Integrity Service

  • createdAtstring<date-time>read-only
  • extraobject

    Hashed into the CID; not stored

    Show properties

    Map of string

  • fileAttachmentscore.FileAttachment[]read-only

    Upload via the with-file endpoint

    Show properties

    Array of core.FileAttachment

    • assessmentDeclarationIdinteger

      AssessmentDeclarationID is set instead when the file belongs to an agent assessment's declaration

    • cidstring
    • contentTypestring
    • declarationIdinteger
    • descriptionstring
    • fileNamestring
    • idinteger
    • isPublicboolean
    • retentionExpiresstring<date-time>
    • reviewIdinteger
    • sizeBytesinteger
    • storagePathstring
    • uploadedAtstring<date-time>
    • uploadedBystring
    • uploadedByDidstringread-only

      Verifiable actor; uploadedBy is the label

  • idintegerread-only
  • isAutomatedbooleanread-only

    True for indicator-generated only

  • isReadyForReviewboolean

    Needs submit_controls_for_review

  • statementstring
  • subjectLinestring
  • submittedAtstring<date-time>read-only
  • submittedBystring

    Defaults to the caller identity

  • submittedByDidstringread-only

    Verifiable actor; submittedBy is the label

  • updatedAtstring<date-time>read-only
Examplejson
{
  "appliedPolicyControlId": 0,
  "attachmentCid": [
    "string"
  ],
  "cid": "string",
  "createdAt": "2025-01-01T00:00:00Z",
  "extra": {
    "key": "string"
  },
  "fileAttachments": [
    {
      "assessmentDeclarationId": 0,
      "cid": "string",
      "contentType": "string",
      "declarationId": 0,
      "description": "string",
      "fileName": "string",
      "id": 0,
      "isPublic": true,
      "retentionExpires": "2025-01-01T00:00:00Z",
      "reviewId": 0,
      "sizeBytes": 0,
      "storagePath": "string",
      "uploadedAt": "2025-01-01T00:00:00Z",
      "uploadedBy": "string"
    }
  ],
  "id": 0,
  "isAutomated": true,
  "isReadyForReview": true,
  "statement": "string",
  "subjectLine": "string",
  "submittedAt": "2025-01-01T00:00:00Z",
  "submittedBy": "string",
  "submittedByDid": "string",
  "updatedAt": "2025-01-01T00:00:00Z"
}

400Bad request - Invalid IDs or request body

application/json
  • errorstring
Examplejson
{
  "error": "Invalid request body"
}

401Unauthorized - Authentication required

application/json
  • errorstring
Examplejson
{
  "error": "Invalid request body"
}

403Forbidden - Insufficient permissions to create declarations

application/json
  • errorstring
Examplejson
{
  "error": "Invalid request body"
}

404Not found - Unknown or mismatched identifier

application/json
  • errorstring
Examplejson
{
  "error": "Invalid request body"
}

500Internal server error

application/json
  • errorstring
Examplejson
{
  "error": "Invalid request body"
}