Attachment service#
The attachment service provides functionality for creating, updating, and archiving attachments uploaded to S3.
OpenAPI file: AttachmentService.json
Endpoints#
Create#
POST /attachments/v1/attachments
Create a new attachment. Assumes the file is already uploaded to S3 through the upload service.
Body
s3Pathstring required
titlestring required
descriptionstring required
propertiesmap ofPropertyNameto string
labelsarray of string
workspacestring (RID)The workspace in which to create the attachment. If not provided, the attachment will be created in the default workspace for the user’s organization, if the default workspace for the organization is configured.
Response
ridstring (RID)
titlestring
s3Pathstring
fileTypestring
descriptionstring
createdBystring (RID)
propertiesmap ofPropertyNameto string
labelsarray of string
createdAtstring (date-time)
isArchivedboolean
Request
curl -X POST "https://api.gov.nominal.io/api/attachments/v1/attachments" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"s3Path": "<s3 path>",
"title": "<title>",
"description": "<description>"
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/attachments/v1/attachments",
headers={"Authorization": "Bearer <api key>"},
json={"s3Path": "<s3 path>", "title": "<title>", "description": "<description>"},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/attachments/v1/attachments",
headers={"Authorization": "Bearer <api key>"},
json={"s3Path": "<s3 path>", "title": "<title>", "description": "<description>"},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/attachments/v1/attachments",
headers={"Authorization": "Bearer <api key>"},
json={
"s3Path": "<s3 path>",
"title": "<title>",
"description": "<description>",
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"rid": "<attachment rid>",
"title": "<title>",
"s3Path": "<s3 path>",
"fileType": "<file type>",
"description": "<description>",
"createdBy": "<created by>",
"properties": {
"<key>": "<property value>"
},
"labels": [
"<label>"
],
"createdAt": "2026-01-01T00:00:00Z",
"isArchived": true
}
Get#
GET /attachments/v1/attachments/{rid}
Get an attachment by its RID.
Path parameters
ridstring (RID) required
Response
ridstring (RID)
titlestring
s3Pathstring
fileTypestring
descriptionstring
createdBystring (RID)
propertiesmap ofPropertyNameto string
labelsarray of string
createdAtstring (date-time)
isArchivedboolean
Request
curl "https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>" \
-H "Authorization: Bearer <api key>"
import requests
response = requests.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>",
headers={"Authorization": "Bearer <api key>"},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"rid": "<attachment rid>",
"title": "<title>",
"s3Path": "<s3 path>",
"fileType": "<file type>",
"description": "<description>",
"createdBy": "<created by>",
"properties": {
"<key>": "<property value>"
},
"labels": [
"<label>"
],
"createdAt": "2026-01-01T00:00:00Z",
"isArchived": true
}
Update#
PUT /attachments/v1/attachments/{rid}
Update an attachment. Only the fields that are set in the request will be updated.
Path parameters
ridstring (RID) required
Body
titlestring
descriptionstring
propertiesmap ofPropertyNameto string
labelsarray of string
Response
ridstring (RID)
titlestring
s3Pathstring
fileTypestring
descriptionstring
createdBystring (RID)
propertiesmap ofPropertyNameto string
labelsarray of string
createdAtstring (date-time)
isArchivedboolean
Request
curl -X PUT "https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"title": "<title>",
"description": "<description>",
"properties": {
"<key>": "<property value>"
},
"labels": [
"<label>"
]
}'
import requests
response = requests.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>",
headers={"Authorization": "Bearer <api key>"},
json={
"title": "<title>",
"description": "<description>",
"properties": {"<key>": "<property value>"},
"labels": ["<label>"],
},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>",
headers={"Authorization": "Bearer <api key>"},
json={
"title": "<title>",
"description": "<description>",
"properties": {"<key>": "<property value>"},
"labels": ["<label>"],
},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>",
headers={"Authorization": "Bearer <api key>"},
json={
"title": "<title>",
"description": "<description>",
"properties": {"<key>": "<property value>"},
"labels": ["<label>"],
},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"rid": "<attachment rid>",
"title": "<title>",
"s3Path": "<s3 path>",
"fileType": "<file type>",
"description": "<description>",
"createdBy": "<created by>",
"properties": {
"<key>": "<property value>"
},
"labels": [
"<label>"
],
"createdAt": "2026-01-01T00:00:00Z",
"isArchived": true
}
Get batch#
POST /attachments/v1/attachments/batch
Get a set of attachments by their RIDs.
Body
attachmentRidsarray of string (RID)
Response
responsearray ofAttachment
Fields of
Attachmentridstring (RID)
titlestring
s3Pathstring
fileTypestring
descriptionstring
createdBystring (RID)
propertiesmap ofPropertyNameto string
labelsarray of string
createdAtstring (date-time)
isArchivedboolean
Request
curl -X POST "https://api.gov.nominal.io/api/attachments/v1/attachments/batch" \
-H "Authorization: Bearer <api key>" \
-H "Content-Type: application/json" \
--data '{
"attachmentRids": [
"<attachment rid>"
]
}'
import requests
response = requests.post(
"https://api.gov.nominal.io/api/attachments/v1/attachments/batch",
headers={"Authorization": "Bearer <api key>"},
json={"attachmentRids": ["<attachment rid>"]},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.post(
"https://api.gov.nominal.io/api/attachments/v1/attachments/batch",
headers={"Authorization": "Bearer <api key>"},
json={"attachmentRids": ["<attachment rid>"]},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.post(
"https://api.gov.nominal.io/api/attachments/v1/attachments/batch",
headers={"Authorization": "Bearer <api key>"},
json={"attachmentRids": ["<attachment rid>"]},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"response": [
{
"rid": "<attachment rid>",
"title": "<title>",
"s3Path": "<s3 path>",
"fileType": "<file type>",
"description": "<description>",
"createdBy": "<created by>",
"properties": {
"<key>": "<property value>"
},
"labels": [
"<label>"
],
"createdAt": "2026-01-01T00:00:00Z",
"isArchived": true
}
]
}
Get content#
GET /attachments/v1/attachments/{rid}/content
Get the binary content of an attachment.
Path parameters
ridstring (RID) required
Response: application/octet-stream
The body is the raw bytes.
A successful response.
Request
curl "https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/content" \
-H "Authorization: Bearer <api key>" \
--output "<file>"
from pathlib import Path
import requests
response = requests.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/content",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
Path("<file>").write_bytes(response.content)
from pathlib import Path
import httpx
response = httpx.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/content",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
Path("<file>").write_bytes(response.content)
import asyncio
from pathlib import Path
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/content",
headers={"Authorization": "Bearer <api key>"},
) as response:
response.raise_for_status()
Path("<file>").write_bytes(await response.read())
asyncio.run(main())
Response: 200
The raw bytes.
Get uri#
GET /attachments/v1/attachments/{rid}/uri
Get a pre-signed URI to download an attachment. The link expires in 1 minute.
Path parameters
ridstring (RID) required
Response
uristring
Request
curl "https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/uri" \
-H "Authorization: Bearer <api key>"
import requests
response = requests.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/uri",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import httpx
response = httpx.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/uri",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.get(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/uri",
headers={"Authorization": "Bearer <api key>"},
) as response:
response.raise_for_status()
print(await response.json())
asyncio.run(main())
Response: 200
{
"uri": "<uri>"
}
Archive#
PUT /attachments/v1/attachments/{rid}/archive
Archive an attachment.
Path parameters
ridstring (RID) required
Response
No content (HTTP 204).
Request
curl -X PUT "https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/archive" \
-H "Authorization: Bearer <api key>"
import requests
response = requests.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/archive",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
import httpx
response = httpx.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/archive",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/archive",
headers={"Authorization": "Bearer <api key>"},
) as response:
response.raise_for_status()
asyncio.run(main())
Response: 204
No content.
Unarchive#
PUT /attachments/v1/attachments/{rid}/unarchive
Unarchive an attachment.
Path parameters
ridstring (RID) required
Response
No content (HTTP 204).
Request
curl -X PUT "https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/unarchive" \
-H "Authorization: Bearer <api key>"
import requests
response = requests.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/unarchive",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
import httpx
response = httpx.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/unarchive",
headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
import asyncio
import aiohttp
async def main() -> None:
async with aiohttp.ClientSession() as session:
async with session.put(
"https://api.gov.nominal.io/api/attachments/v1/attachments/<rid>/unarchive",
headers={"Authorization": "Bearer <api key>"},
) as response:
response.raise_for_status()
asyncio.run(main())
Response: 204
No content.
Errors#
Errors shows how these errors are sent.
Each error’s errorName is Attachment: followed by its name below.
Status |
Name |
Notes |
|---|---|---|
400 |
|
|
404 |
|
|
404 |
|
|
404 |
|
Types#
Attachment#
ridstring (RID) required
titlestring required
s3Pathstring required
fileTypestring required
descriptionstring required
createdBystring (RID) required
propertiesmap ofPropertyNameto string
labelsarray of string
createdAtstring (date-time) required
isArchivedboolean required
Page design based on Scalar, MIT License.