Unique Code
Unique code collection stores individual identifier codes generated from identifier jobs, including their digital link representations, EPC keys, and current assignment or reservation status.
The unique_code Object
Unique code collection contains the actual generated identifier codes that result from the execution of identifier jobs, providing digital link URLs, EPC integration keys, and status tracking for individual codes within the TrackVision system.
| Field Name | Type | Description |
|---|---|---|
id | uuid | Primary key. Unique identifier for the unique code record (UUID format). |
user_created | object | User who created the unique code record. Read-only. Links to directus_users. |
date_created | datetime | Timestamp in ISO 8601 when the unique code was created. Read-only. |
user_updated | object | User who last updated the unique code record. Read-only. Links to directus_users. |
date_updated | datetime | Timestamp in ISO 8601 when the unique code was last updated. Read-only. |
digital_link | string | Complete digital link URL for the unique code (e.g., "https://mybrand.tvai.me/01/09312345551927/21/17DZfpiY"). |
code | string | The actual unique identifier code generated (e.g., "17DZfpiY"). |
product | string | Product identifier this code is associated with (primary key from product collection). |
identifier_job | object | Reference to the identifier job that generated this code. Links to identifier_job. |
epc_join_key | string | Unique key for EPC (Electronic Product Code) system integration, combining product and code identifiers. |
status | string | Current status of the unique code. Default: "unassigned". Values: "unassigned", "reserved", "assigned", "encoded". |
reservation | object | Reference to the code reservation that currently holds this code (if reserved). Links to code_reservation. |
type | string | Type of identifier code (e.g., "sgtin", "sscc", "grai"). |
custom_id | string | Optional custom identifier for the unique code. |
Sub-Objects
User Object (user_created, user_updated)
See Users for the full schema.
Identifier Job Object (identifier_job)
See Identifier Job for the full schema.
Code Reservation Object (reservation)
See Code Reservation for the full schema.
List Unique Codes
List existing unique codes.
- REST
- GraphQL
GET /items/unique_code
query {
unique_code {
id
code
product
digital_link
status
type
epc_join_key
identifier_job {
id
reference_id
}
reservation {
id
reference_id
}
date_created
date_updated
}
}
Query Parameters
Supports all global query parameters.
Returns
An array of up to limit unique code objects. If no items are available, data will be an empty array.
Retrieve a Unique Code
Retrieve a specific unique code by ID.
- REST
- GraphQL
GET /items/unique_code/:id
query {
unique_code_by_id(id: "unique_code_id") {
id
digital_link
code
product
identifier_job {
id
reference_id
type
}
epc_join_key
status
reservation {
id
reference_id
reserved_for
}
type
user_created {
id
first_name
last_name
}
date_created
user_updated {
id
first_name
last_name
}
date_updated
}
}
Returns
Returns a unique code object if a valid primary key was provided.
Create a Unique Code
Create a new unique code.
- REST
- GraphQL
POST /items/unique_code
{
"digital_link": "https://food.tvai.me/01/09312345551927/21/ABC123XY",
"code": "ABC123XY",
"product": "/01/09312345551927",
"identifier_job": "f1b2c3d4-e5f6-7890-1234-567890abcdef",
"epc_join_key": "09312345551927-ABC123XY",
"type": "sgtin"
}
mutation {
create_unique_code_item(data: {
digital_link: "https://food.tvai.me/01/09312345551927/21/ABC123XY"
code: "ABC123XY"
product: "/01/09312345551927"
identifier_job: "f1b2c3d4-e5f6-7890-1234-567890abcdef"
epc_join_key: "09312345551927-ABC123XY"
type: "sgtin"
}) {
id
code
product
digital_link
status
type
identifier_job {
id
reference_id
}
}
}
Query Parameters
Supports all global query parameters.
Request Body
A partial unique code object.
Returns
Returns the unique code object for the created unique code.
Update a Unique Code
Update an existing unique code.
- REST
- GraphQL
PATCH /items/unique_code/:id
{
"status": "assigned",
"reservation": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
}
mutation {
update_unique_code_item(id: "unique_code_id", data: {
status: "assigned"
reservation: "a1b2c3d4-e5f6-7890-1234-567890abcdef"
}) {
id
code
status
reservation {
id
reference_id
}
}
}
Query Parameters
Supports all global query parameters.
Request Body
A partial unique code object.
Returns
Returns the unique code object for the updated unique code.
Delete a Unique Code
Delete an existing unique code.
- REST
- GraphQL
DELETE /items/unique_code/:id
mutation {
delete_unique_code_item(id: "unique_code_id") {
id
}
}
Returns
Empty body.
Sample Data
| ID | Code | Product | Digital Link | Status | Type |
|---|---|---|---|---|---|
| 016dca91-d281-4361-98d5-f006f4dafc21 | 17DZfpiY | /01/09312345551927 | https://mybrand.tvai.me/01/09312345551927/21/17DZfpiY | reserved | sgtin |
| 0187f1a4-2f83-4026-93c9-f3e033304314 | 4qt8Jblr | /01/09312345552016 | https://mybrand.tvai.me/01/09312345552016/21/4qt8Jblr | reserved | sgtin |
| 01d039e3-ea64-4a1c-933a-fa5fe604a5fd | YZQDrcpP | /01/09312345551927 | https://mybrand.tvai.me/01/09312345551927/21/YZQDrcpP | reserved | sgtin |