Count projects
Count projects: countProjects in the TypeScript, Python, Rust and Go clients.
GET /v1/organizations/{organizationId}/projects/count
Counts the projects the same filter would list. The count is read from the primary, so it is authoritative rather than replica-lagged.
photon.organizations.projects.count(input: CountProjectsInput, options?: RequestOptions): Promise<CountProjectsOutput>photon.organizations.projects.count(input: CountProjectsInput, *, options: RequestOptions | None = None) -> models.ProjectCountclient.count_projects(organization_id: String, params: Option<CountProjectsParams>).await -> Result<ResponseValue<types::ProjectCount>, Error<CountProjectsError>>client.Organizations.Projects.Count(ctx context.Context, params *CountProjectsParams, opts ...RequestOption) (*ProjectCount, error)import { Photon } from "@photon-ai/api";
const photon = new Photon({
headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
});
const result = await photon.organizations.projects.count({
path: {
organizationId: "organizationId",
},
});import os
from photon_api import Photon
from photon_api.rpc_generated import CountProjectsInput
photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
result = photon.organizations.projects.count(
CountProjectsInput.model_validate({
"path": {
"organizationId": "organizationId",
},
})
)use photon_ai_api::{Credential, PhotonClientBuilder, SecretString};
let token = std::env::var("PHOTON_API_TOKEN")?;
let client = PhotonClientBuilder::new()
.credential("accountServiceKey", Credential::Bearer(SecretString::from(token)))
.build()?;
let result = client
.count_projects("organizationId".to_owned(), None)
.await
.map_err(|error| format!("{error:?}"))?
.into_inner();import (
"context"
"os"
photonapi "github.com/photon-hq/api/packages/go"
)
ctx := context.Background()
client := photonapi.NewClient(photonapi.WithAPIKey(os.Getenv("PHOTON_API_TOKEN")))
result, err := client.Organizations.Projects.Count(ctx, &photonapi.CountProjectsParams{
OrganizationID: "organizationId",
})
if err != nil {
return err
}
_ = result{
"count": 0
}Parameters
Selects the API contract date. Without it, the request is served as 2026-07-01.
Returns
200 The number of matching projects. ProjectCount
Headers: ETag, Photon-Version. The raw response carries these headers; see Raw responses.
304 Not Modified. Sent only when If-None-Match matches the ETag of an earlier 200 response for the same representation; no body. No body.
Headers: ETag, Photon-Version. The raw response carries these headers; see Raw responses.