API Documentation
Unified Consent Core API (2.0.0)
Download OpenAPI specification:Download
📍 Regional Distribution
The UC Core API is regionally distributed. Requests originating from the United States are processed in us-east-1, while requests from all other regions are processed in eu-central-1.
The Unified Consent Core API is a REST API to interact with the Osano Unified Consent platform. Before use, you must sign up at https://osano.com. You are bound by the Osano terms of service and limits placed by those terms. All interactions with the API except the health check (GET /) and token creation (POST /v2/token/create) require authentication using an Osano API key, or a Unified Consent API key in the x-osano-api-key and x-uc-api-key headers respectively. They are detailed in the "Authentication" section.
curl --header 'x-uc-api-key: <API_KEY>' https://uc.api.osano.com/v2/consents/check/some-subject-id
All resources are versioned according to semantic versioning with the major version being specified in the endpoints URI such as v2.
All major versioning will maintain backwards compatibility in that major version. Resources may add new minor versions that are not specified in the URI. The minor versions will never break backward compatibility but may add new resources or enhancements. The enhancements may include new data in the schema. We will never remove data from a schema in the same major version. To prevent your scripts or applications from breaking due to newly added data, do not error on unexpected data.
We will make a best effort to notify users when we release new major versions. We will deprecate the previous major version. Major versions may have breaking changes from previous versions such as schema changes or resource removal. All users should upgrade to the new major version in a timely manner.
The Unified Consent Core API uses API keys to authenticate requests that are generated on a per-user basis. All calls except GET / and POST /v2/token/create require a valid, unexpired API key. There are two types of API keys that can be used with the Unified Consent Core API. They are the Osano API key and the Unified Consent API key. The routes that create or update subject profiles (POST /v2/subjects/profile and POST /v2/subjects/profile/verification-code) require the Osano API key. All other routes, including POST /v2/subjects/merge, require the Unified Consent API key.
Osano API key
Osano API keys may be generated within the Osano settings -> API Keys page. You must be an admin or have the correct privileges to generate an API key.
Once generated, the API key should be included in the x-osano-api-key header of those routes. For example:
curl --location 'https://uc.api.osano.com/v2/subjects/profile' \
--header 'x-osano-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"email": "person@example.com"
}'
Unified Consent API key
Unified Consent API keys may be generated by using the /v2/token/create route. First gather the configId and the customerId from the Configuration details page. (Select the desired Configuration from the Configurations list page) For example:
curl --location 'https://uc.api.osano.com/v2/token/create' \
--header 'Content-Type: application/json' \
--data '{
"customerId": "some-customer-id",
"configId": "some-config-id"
}'
Note: Unified Consent API keys are scoped to a single Configuration, and will not work to submit consents for another Configuration
To keep an anonymous visitor's consents after they log in, call POST /v2/subjects/merge with the anonymous ID as sourceSubjectId and the verified ID as targetSubjectId:
curl --location 'https://uc.api.osano.com/v2/subjects/merge' \
--header 'x-uc-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"sourceSubjectId": "<anonymous-id>",
"targetSubjectId": "<verified-id>"
}'
The following type describes the body of the request to create a consent. If submitting a GPC request, the actions array in the payload will be ignored and can be omitted. GPC actions are calculated internally based on the configured privacy protocols and the provided or detected geolocation:
type CreateConsentRequest = {
compliance?: {
privacyPolicy?: {
version?: string // The privacy policy version active at the time of submitting the consent
url: string // The URL of the privacy policy
}
gpc?: number // 1 if GPC is enabled, 0 otherwise
}
subject: {
verifiedId?: string // If the subject is verified, provide the subject's verified ID
anonymousId?: string // If the subject is anonymous, provide the subject's anonymous ID
}
jurisdiction?: string | null // The applicable jurisdiction for the subject. Must be one of the configured jurisdictions, or null if none are applicable. Does not affect conflict resolution if omitted, but other features such as consent search may be affected.
actions: [
{
target: string // The privacy protocol ID to submit consent for.
vendor: string // The UC configuration ID to associate with the consent.
action: string // The subject's consent choice for the privacy protocol. Recognized values: 'ACCEPT' | 'REJECT' | 'UNSELECTED', matched case-insensitively and stored uppercase. Any other value is not validated and is stored as sent.
jurisdiction?: string | null // The applicable jurisdiction for the subject. Must be one of the configured jurisdictions, or null if none are applicable. Does not affect conflict resolution if omitted, but other features such as consent search may be affected. Will override the top level jurisdiction if set.
},
]
tags: string[] // Tags associated with the consent. Can be any string. Ex: ['ccpa', 'tcpa']
attributes: { [key: string]: any } // Required (send {} if you have none). Attributes associated with the consent, e.g. { platform: 'Linux x86_64' }. `ipAddress` and `userAgent` are automatically populated, and values passed for those keys here will be overwritten.
origin?: 'api' | 'gpc' // If submitting a GPC consent, use 'gpc', otherwise use 'api'
}
Applicable jurisdictions for a UC configuration can be determined by making a request to the /v2/collections endpoint.
To populate the target and vendor values for a consent it is necessary to determine the privacy protocol ID and the UC configuration ID respectively.
Finding the UC configuration ID
To find the UC configuration ID, navigate to the UC configurations page. Click on the desired configuration to open the configuration details page. Click on the "Developers" tab, revealing the Config ID.
Finding the privacy protocol ID
To find the privacy protocol ID, follow the steps above to open the desired UC configuration's details page. Click on the "Privacy Protocols" tab. From the list of privacy protocols, pick the desired privacy protocol and click the pencil icon to open the "Edit Privacy Protocol" modal. There you will find the Target ID, which is the privacy protocol ID.
Retrieves the unified consent for a subject.
Retrieves the unified consent for a subject.
Authorizations:
path Parameters
| subjectRef required | string Anonymous id, verified id, or a valid session id. |
query Parameters
| ref | string Enum: "subject" "session" Indicates what type of reference is provided for the subject. Supports a subject id or a session id. |
header Parameters
| x-country-code-override | string Valid ISO 3166-1 country code to override the country resolution based on the IP address. |
| x-region-code-override | string Valid ISO 3166-2 region code to override the region resolution based on the IP address |
Responses
Response samples
- 200
{- "unifiedConsent": {
- "subjectId": "string",
- "brandId": "string",
- "channelIds": [
- "string"
], - "compliance": {
- "privacyPolicy": {
- "version": "string",
- "url": "string"
}, - "gpc": 1
}, - "actions": [
- {
- "target": "string",
- "vendor": "string",
- "action": "string"
}
], - "attributes": null,
- "lastUpdateDate": "string",
- "lastConflictDate": "string"
}, - "conflicts": [
- {
- "type": "string",
- "resolution": "string",
- "actionsInConflict": [
- {
- "target": "string",
- "vendor": "string",
- "action": "string",
- "consentId": "string",
- "channelId": "string",
- "createdAt": "string"
}
]
}
]
}Checks whether a subject has given consent in a co
Checks whether a subject has given consent in a configuration.
Authorizations:
path Parameters
| subjectId required | string |
header Parameters
| x-country-code-override | string Valid ISO 3166-1 country code to override the country resolution based on the IP address. |
| x-region-code-override | string Valid ISO 3166-2 region code to override the region resolution based on the IP address |
Responses
Response samples
- 200
{- "exists": true
}Retrieves the unified consent for a subject.
Retrieves the unified consent for a subject.
Authorizations:
path Parameters
| hashedSubjectId required | string |
query Parameters
| configId required | string non-empty |
header Parameters
| x-country-code-override | string Valid ISO 3166-1 country code to override the country resolution based on the IP address. |
| x-region-code-override | string Valid ISO 3166-2 region code to override the region resolution based on the IP address |
Responses
Response samples
- 200
{- "unifiedConsent": {
- "subjectId": "string",
- "brandId": "string",
- "channelIds": [
- "string"
], - "compliance": {
- "privacyPolicy": {
- "version": "string",
- "url": "string"
}, - "gpc": 1
}, - "actions": [
- {
- "target": "string",
- "vendor": "string",
- "action": "string"
}
], - "attributes": null,
- "lastUpdateDate": "string",
- "lastConflictDate": "string"
}, - "conflicts": [
- {
- "type": "string",
- "resolution": "string",
- "actionsInConflict": [
- {
- "target": "string",
- "vendor": "string",
- "action": "string",
- "consentId": "string",
- "channelId": "string",
- "createdAt": "string"
}
]
}
]
}Retrieves all collections for a given configId based on jurisdiction
Uses the configId embedded in the Unified Consent API key to retrieve an aggregate of all applicable collections of privacy protocols for a given jurisdiction. The type can either be 'draft' or 'published'. If the type is not provided, the default is 'published'. If the jurisdiction is not provided, IP geolocation is used to determine the jurisdiction. The response merges the configuration's default collection, the collections of the jurisdiction's parents and the jurisdiction's own collection, so 'us-ca' also returns the 'us' protocols. When nothing matches, the response has no collection.
Authorizations:
query Parameters
| jurisdiction | string Examples:
A country code, optionally followed by more specific levels separated by '-', such as 'us', 'us-ca' or 'ca-qc'. Case-insensitive. Use a value from the |
| type | string Default: "published" Enum: "published" "draft" |
Responses
Response samples
- 200
{- "jurisdictions": [
- "string"
], - "collection": {
- "collectionId": "string",
- "name": "string",
- "frameworks": [
- "string"
], - "configIds": [
- "string"
], - "jurisdiction": "string",
- "created": "string",
- "updated": "string",
- "type": "string",
- "consents": [
- {
- "privacyProtocolId": "string",
- "name": "string",
- "trigger": "string",
- "type": "consent",
- "title": "string",
- "description": "string",
- "defaultAction": "ACCEPT",
- "acceptWording": "string",
- "rejectWording": "string",
- "enabled": true,
- "collectionId": "string",
- "frameworks": [
- "string"
], - "frameworkDefaults": {
- "gpc": true
}, - "integrations": [
- { }
]
}
], - "preferences": [
- {
- "privacyProtocolId": "string",
- "name": "string",
- "trigger": "string",
- "type": "consent",
- "title": "string",
- "description": "string",
- "defaultAction": "ACCEPT",
- "acceptWording": "string",
- "rejectWording": "string",
- "enabled": true,
- "collectionId": "string",
- "frameworks": [
- "string"
], - "frameworkDefaults": {
- "gpc": true
}, - "integrations": [
- { }
]
}
]
}
}Retrieves a collection of privacy protocols
Retrieves a collection of privacy protocols by id
Authorizations:
path Parameters
| collectionId required | string |
Responses
Response samples
- 200
{- "collectionId": "string",
- "name": "string",
- "frameworks": [
- "string"
], - "configIds": [
- "string"
], - "jurisdiction": "string",
- "created": "string",
- "updated": "string",
- "type": "string",
- "consents": [
- {
- "privacyProtocolId": "string",
- "name": "string",
- "trigger": "string",
- "type": "consent",
- "title": "string",
- "description": "string",
- "defaultAction": "ACCEPT",
- "acceptWording": "string",
- "rejectWording": "string",
- "enabled": true,
- "collectionId": "string",
- "frameworks": [
- "string"
], - "frameworkDefaults": {
- "gpc": true
}, - "integrations": [
- { }
]
}
], - "preferences": [
- {
- "privacyProtocolId": "string",
- "name": "string",
- "trigger": "string",
- "type": "consent",
- "title": "string",
- "description": "string",
- "defaultAction": "ACCEPT",
- "acceptWording": "string",
- "rejectWording": "string",
- "enabled": true,
- "collectionId": "string",
- "frameworks": [
- "string"
], - "frameworkDefaults": {
- "gpc": true
}, - "integrations": [
- { }
]
}
]
}Retrieves subject by id or from a valid session
Retrieves subject by id or from a valid session
Authorizations:
path Parameters
| subjectRef required | string Anonymous id, verified id, or a valid session id. |
query Parameters
| ref | string Enum: "subject" "session" Indicates what type of reference is provided for the subject. Supports a subject id or a session id. |
Responses
Response samples
- 200
{- "id": "string",
- "verifiedId": "string",
- "anonymousId": "string"
}Response samples
- 200
{- "configId": "string",
- "customerId": "string",
- "name": "string",
- "domains": [
- "string"
], - "privacyPolicyUrl": "string",
- "privacyPolicyVersion": 0,
- "processingTime": 0,
- "processingUnit": "string",
- "privacyProtocols": [
- {
- "privacyProtocolId": "string",
- "name": "string",
- "type": "string",
- "integrations": [
- {
- "connection": {
- "label": "string",
- "value": "string"
}, - "operation": {
- "label": "string",
- "value": "string"
}, - "additionalFields": true,
- "fields": { },
- "protocolValue": [
- "string"
]
}
], - "enabled": true,
- "trigger": "string"
}
], - "jurisdictionLookup": "string",
- "homepageUrl": "string",
- "created": "string",
- "updated": "string",
- "helpUrl": "string",
- "frameworks": [
- "string"
], - "headings": {
- "fontFamily": "string",
- "color": "string",
- "backgroundColor": "string"
}, - "paragraphs": {
- "fontFamily": "string",
- "color": "string",
- "backgroundColor": "string"
}, - "links": {
- "fontFamily": "string",
- "color": "string",
- "backgroundColor": "string"
}, - "primaryButtons": {
- "fontFamily": "string",
- "color": "string",
- "backgroundColor": "string"
}, - "secondaryButtons": {
- "fontFamily": "string",
- "color": "string",
- "backgroundColor": "string"
}, - "gpcSignalBanner": {
- "fontFamily": "string",
- "color": "string",
- "backgroundColor": "string"
}, - "pageBackground": "string",
- "published": "string",
- "unpublishedPageId": 0,
- "publishedPageId": 0,
- "welcomePageEnabled": true,
- "smsVerificationEnabled": true,
- "cuiTextCustomizations": [
- {
- "title": "string",
- "locale": "string",
- "gpcBanner": true,
- "gpcBannerEnabledText": "string",
- "gpcBannerDisabledText": "string",
- "welcomeBackTitle": "string",
- "welcomeBackDescription": "string",
- "signOutLink": "string",
- "welcomePage": {
- "title": "string",
- "description": "string",
- "continueAnonymouslyButton": "string",
- "signUpButton": "string",
- "verificationFactorInputTitle": "string",
- "verificationFactorInputDescription": "string",
- "emailSelector": "string",
- "phoneSelector": "string",
- "emailInputPlaceholder": "string",
- "verificationFactorInputSubmitButton": "string"
}, - "signUpPage": {
- "title": "string",
- "description": "string",
- "cancelButton": "string",
- "submitButton": "string",
- "emailInputLabel": "string",
- "emailInputRequiredText": "string",
- "emailInputPlaceholder": "string",
- "backButton": "string",
- "profileFields": [
- {
- "target": "string",
- "label": "string",
- "placeholder": "string",
- "validationRegex": "string",
- "fieldType": "string",
- "errorMessage": "string"
}
], - "emailSelector": "string",
- "phoneSelector": "string",
- "phoneInputLabel": "string"
}, - "consentsPage": {
- "title": "string",
- "submitButton": "string",
- "modalTitle": "string",
- "modalDescription": "string",
- "modalCloseButton": "string",
- "modalNextButton": "string",
- "modalNextDescription": "string",
- "noConsentsTitle": "string",
- "noConsentsDescription": "string",
- "verificationFactorInputDescription": "string",
- "emailInputLabel": "string",
- "emailInputPlaceholder": "string",
- "verificationFactorInputSubmitButton": "string",
- "emailSelector": "string",
- "phoneSelector": "string"
}, - "preferencesPage": {
- "title": "string",
- "submitButton": "string",
- "modalTitle": "string",
- "modalDescription": "string",
- "modalCloseButton": "string",
- "modalNextButton": "string",
- "modalNextDescription": "string",
- "submitButtonDisabledDescription": "string",
- "verificationFactorInputDescription": "string",
- "emailInputLabel": "string",
- "emailInputPlaceholder": "string",
- "verificationFactorInputSubmitButton": "string",
- "emailSelector": "string",
- "phoneSelector": "string"
}, - "validationModal": {
- "title": "string",
- "description": "string",
- "disclaimer": "string",
- "inputLabel": "string",
- "inputPlaceholder": "string",
- "submitButton": "string",
- "cancelButton": "string"
}, - "smsValidationModal": {
- "title": "string",
- "description": "string",
- "disclaimer": "string",
- "inputLabel": "string",
- "inputPlaceholder": "string",
- "submitButton": "string",
- "cancelButton": "string"
}, - "geolocationModal": {
- "manualTitle": "string",
- "manualAgreeLabel": "string",
- "manualDropdownPlaceholder": "string",
- "manualDropdownLabel": "string",
- "confirmationTitle": "string",
- "confirmationDescriptionKnown": "string",
- "confirmationDescriptionUnknown": "string",
- "confirmationDropdownPlaceholder": "string",
- "confirmationDropdownLabel": "string",
- "confirmationAgreeLabel": "string"
}, - "navigationItems": [
- {
- "title": "string",
- "route": "string",
- "key": "string"
}
]
}
]
}Create and insert a consent
Create and insert a consent
Authorizations:
header Parameters
| x-country-code-override | string Valid ISO 3166-1 country code to override the country resolution based on the IP address. |
| x-region-code-override | string Valid ISO 3166-2 region code to override the region resolution based on the IP address |
Request Body schema: application/json
| sessionToken | string Optional session token returned by the create profile endpoint. |
required | object |
object (compliance) | |
required | Array of objects |
required | object Custom key/value attributes, e.g. { "platform": "Linux x86_64" }. ipAddress and userAgent are set by the API. |
| origin | string |
| jurisdiction | string |
Responses
Request samples
- Payload
{- "sessionToken": "string",
- "subject": {
- "verifiedId": "string",
- "anonymousId": "string"
}, - "compliance": {
- "privacyPolicy": {
- "version": "string",
- "url": "string"
}, - "gpc": 1
}, - "actions": [
- {
- "target": "string",
- "vendor": "string",
- "action": "string",
- "jurisdiction": "string"
}
], - "attributes": { },
- "origin": "string",
- "jurisdiction": "string"
}Create and insert a gpc consent
Create and insert a gpc consent
Authorizations:
header Parameters
| x-country-code-override | string Valid ISO 3166-1 country code to override the country resolution based on the IP address. |
| x-region-code-override | string Valid ISO 3166-2 region code to override the region resolution based on the IP address |
Request Body schema: application/json
required | object |
object (gpc-compliance) | |
required | object Custom key/value attributes, e.g. { "platform": "Linux x86_64" }. ipAddress and userAgent are set by the API. |
| jurisdiction | string |
Responses
Request samples
- Payload
{- "subject": {
- "verifiedId": "string",
- "anonymousId": "string"
}, - "compliance": {
- "gpc": 1
}, - "attributes": { },
- "jurisdiction": "string"
}Response samples
- 201
{- "gpcActions": [
- {
- "target": "string",
- "vendor": "string",
- "action": "string",
- "jurisdiction": "string"
}
]
}Merge subjects (an anonymous and a verified)
Merge subjects (an anonymous and a verified)
Authorizations:
header Parameters
| content-type required | string Value: "application/json" The payload is a valid serialized JSON object |
Request Body schema: application/jsonrequired
| sourceSubjectId required | string non-empty The anonymous subject id to merge from. |
| targetSubjectId required | string non-empty The verified subject id to merge into. |
Responses
Request samples
- Payload
{- "sourceSubjectId": "string",
- "targetSubjectId": "string"
}Response samples
- 200
"string"Verify a subject profile using Email
Verify a subject profile using Email
Authorizations:
header Parameters
| content-type required | string Value: "application/json" The payload is a valid serialized JSON object |
Request Body schema: application/jsonrequired
| email required | string <email> non-empty |
| code required | string = 6 characters |
Responses
Request samples
- Payload
{- "email": "user@example.com",
- "code": "string"
}Response samples
- 200
{- "verifiedId": "string"
}Verify a subject profile using SMS
Verify a subject profile using SMS
Authorizations:
header Parameters
| content-type required | string Value: "application/json" The payload is a valid serialized JSON object |
Request Body schema: application/jsonrequired
| phone required | string non-empty |
| code required | string = 8 characters |
| session required | string non-empty |
Responses
Request samples
- Payload
{- "phone": "string",
- "code": "stringst",
- "session": "string"
}Response samples
- 200
{- "verifiedId": "string"
}Sends a verification email to a subject
Sends a verification email to a subject
Authorizations:
header Parameters
| content-type required | string Value: "application/json" The payload is a valid serialized JSON object |
Request Body schema: application/jsonrequired
| email required | string <email> non-empty |
Responses
Request samples
- Payload
{- "email": "user@example.com"
}Send a verification text to a subject
Send a verification text to a subject
Authorizations:
header Parameters
| content-type required | string Value: "application/json" The payload is a valid serialized JSON object |
Request Body schema: application/jsonrequired
| phone required | string non-empty |
Responses
Request samples
- Payload
{- "phone": "string"
}Create profile verification code
Create profile verification code
Authorizations:
header Parameters
| content-type required | string Value: "application/json" The payload is a valid serialized JSON object |
Request Body schema: application/jsonrequired
| email required | string <email> non-empty |
Responses
Request samples
- Payload
{- "email": "user@example.com"
}Response samples
- 201
{- "code": "string"
}Create and insert a subject profile
Create and insert a subject profile
Authorizations:
query Parameters
| resultType | string Default: "subject" Enum: "subject" "session" 'subject' returns the verifiedId, 'session' returns a sessionId for the Consumer UI. |
header Parameters
| content-type required | string Value: "application/json" The payload is a valid serialized JSON object |
Request Body schema: application/json
Requires email or phone.
| email required | string <email> |
| phone | string |
| profile | object |
Responses
Request samples
- Payload
{- "email": "user@example.com",
- "phone": "string",
- "profile": { }
}Response samples
- 200
{- "sessionId": "string",
- "verifiedId": "string"
}