Expand my Community achievements bar.

SOLVED

Deleting segments using API 2.0

Avatar

Level 1

I would like to clean my workspace from unnecessary segments and metrics. To do this, I want to use api 2.0. I managed to connect to Adobe and get the list of components, but when I try to delete a segment, I get status 403. My permissions are not sufficient to modify and delete a segment. I am a system admin and I am trying to delete my own segment. In scope in the api project, I cannot add "segment.delete". Please advise what I should change to be able to delete segments using api 2.0.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hey @d_daszkiewicz, Scope cannot be added/modified to a service. Adobe Analytics has the following scopes: openid, AdobeID, additional_info.projectedProductContext 

 

Scopes are ready only. 

 

I don't think any such scope exists; rather, the issue could be something else. Also, the suggestion to add segment.delete scopes seems to be incorrect. I ran a test in my project, and I was able to delete a segment without any issues, and my project doesn't have any such scope.

 

FarazHusain_0-1751482624470.png

Scopes:

FarazHusain_1-1751482713102.png

 

Can you confirm if you're using - https://developer.adobe.com/analytics-apis/docs/2.0/guides/endpoints/segments/#delete-a-segment? 

When you create an integration, a technical account ID is created, which holds your permission. Can you check if the product profile is linked to the developer console project and has the necessary permissions? Also, the technical account ID needs to be added as product admin for Adobe Analytics. 

 

FarazHusain_2-1751482893302.png

 

I would suggest removing and re-adding the Analytics product profile if you're facing any challenges. If still an issue, please feel free to log a support ticket and we can take a further look.

 

 

 

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @d_daszkiewicz ,

 

Even as a System Admin, API permissions are managed separately via OAuth scopes in the Adobe Developer Console. The segment.delete scope is not enabled by default and must be added explicitly.

 

Update API Project in Adobe Developer Console

  1. Log in to: Adobe Developer Console

  2. Go to your API Project:

    • Select your Project

    • Open the Adobe Analytics API 2.0 integration

  3. Under OAuth Server-to-Server or OAuth Integration, find the Scopes section. 

  4. You will see a list of available scopes. Look forsegment.delete

  5. If segment.deleteis missing or greyed out, it means:

    • The scope is not enabled for your org

    • Or, you’re using the wrong type of credentials (JWT vs OAuth)

Fix Missing Scopes

 

To enable segment.delete:

Option A: Use OAuth (not JWT)

Adobe has been moving away from JWT. Create a new OAuth Client Credential integration:

  • Back in Developer Console:

    • Add new credentials > OAuth Server-to-Server

    • Re-select all needed scopes (look for segment.delete)

    • Generate new API keys and credentials

  • Update your app/script to use the new credentials

Option B: Contact Adobe Support / Admin Console

If the scope is unavailable:

  • Go to Adobe Admin Console

  • Ask your Org Admin or Adobe Support to:

    • Enable segment.delete scope for your org

    • Confirm your role is Product Admin or has custom role with "Delete Segments" in Analytics UI

Make Sure You Have Segment Ownership

Even with correct scopes:

  • You can only delete segments that:

    • You created OR

    • Are shared with you and your role has Manage/Delete permissions

 

Avatar

Community Advisor

Hi @d_daszkiewicz 

Agree with what @pradnya_balvir mentioned below, just to add a bit more context -

Even if you’re a system admin, you might not be able to delete segments via the API unless the right OAuth scopes are enabled in your API project.

Here’s what you can try -

  1. Check Your Integration Type -
    If you’re using an old JWT integration, that could be the blocker. Try creating a new OAuth Server-to-Server integration in the Adobe Developer Console.

  2. Enable the Right Scopes -
    While setting up the new OAuth credentials, make sure to select all relevant scopes, especially 'segment.delete'. If it’s not showing up in the list, it might need to be enabled for your org by Adobe.

  3. Confirm Segment Ownership -
    You can only delete segments you created yourself. Even if you’re a system admin, you can’t remove someone else’s unless you’ve been granted permission.

  4. If it Still Doesn’t Work -
    Might be worth reaching out to Adobe Support or your Org Admin via the Admin Console to double-check that the 'segment.delete' scope is allowed for your org and your role includes delete rights.

Hope that helps!

Avatar

Level 5

You’re getting a 403 error when trying to delete a segment via Adobe Analytics API 2.0 because your API credentials likely lack the required segments.delete scope, or your product profile doesn't allow segment deletion.

To fix this:
1) Add segments.delete scope in your Adobe Developer Console project.
2) Ensure your product profile in Adobe Admin Console allows editing and deleting segments.
3) You can only delete segments you own via the API.

If the segments.delete scope isn’t available, you may need to reconfigure or recreate the API project correctly under the Adobe Analytics product.

https://developer.adobe.com/analytics-apis/docs/2.0/guides/endpoints/segments/

Avatar

Correct answer by
Employee Advisor

Hey @d_daszkiewicz, Scope cannot be added/modified to a service. Adobe Analytics has the following scopes: openid, AdobeID, additional_info.projectedProductContext 

 

Scopes are ready only. 

 

I don't think any such scope exists; rather, the issue could be something else. Also, the suggestion to add segment.delete scopes seems to be incorrect. I ran a test in my project, and I was able to delete a segment without any issues, and my project doesn't have any such scope.

 

FarazHusain_0-1751482624470.png

Scopes:

FarazHusain_1-1751482713102.png

 

Can you confirm if you're using - https://developer.adobe.com/analytics-apis/docs/2.0/guides/endpoints/segments/#delete-a-segment? 

When you create an integration, a technical account ID is created, which holds your permission. Can you check if the product profile is linked to the developer console project and has the necessary permissions? Also, the technical account ID needs to be added as product admin for Adobe Analytics. 

 

FarazHusain_2-1751482893302.png

 

I would suggest removing and re-adding the Analytics product profile if you're facing any challenges. If still an issue, please feel free to log a support ticket and we can take a further look.

 

 

 

Avatar

Adobe Champion

Just a note that segments that are published to the Experience Cloud need to be unpublished first before they can be deleted. I recently was not able to delete a user because a couple segments had publishing turned on and it took me awhile to figure out why. The explanations above are more thorough for sure, but if you're able to delete other segments and not some this may be the reason. Just a note in case it helps

Avatar

Employee Advisor

Agree with @christel_guidon indeed, published segments can't be deleted until these are unpublished from the UI first, also, even the un-publishing would throw you some red-ribbon errors sometimes in UI if these segments are being used in other experience cloud solutions, such as AAM, where they can have some dependencies i.e. folders, traits (which needs to be identified and deleted first). In these instances, this is less straightforward.