> For the complete documentation index, see [llms.txt](https://docs.scepman.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scepman.com/es/administracion-de-certificados/management-rest-api/management-api-in-scepmanclient.md).

# API de administración en SCEPmanClient

Use `Find-SCEPmanCertificate` para buscar certificados emitidos en SCEPman y `Revoke-SCEPmanCertificate` para revocar un certificado cuando ya no es de confianza o ya no se necesita.

### Requisitos

Antes de poder buscar o revocar certificados, asegúrate de que tu identidad tenga el **Manage.All** rol.

Asegúrate también de haber configurado los prerrequisitos generales para el uso de SCEPmanClient: [https://app.gitbook.com/o/-LhPlvZ6dc8XcqY7tdZw/s/-LoGejQeUQcw7lqnQ3WX/\~/edit/\~/changes/863/certificate-management/api-certificates/scepmanclient#prerequisites](https://docs.scepman.com/es/administracion-de-certificados/api-certificates/scepmanclient.md#prerequisites)

{% hint style="info" %}
Si actualizas desde una versión anterior de SCEPman, puede que todavía no tengas el rol Manage.All. Ejecuta `Complete-SCEPmanInstallation` de nuevo en Cloud Shell para agregarlo automáticamente a tu aplicación SCEPman-api.
{% endhint %}

### Buscar certificados

Use `Find-SCEPmanCertificate` para buscar certificados por su número de serie, sujeto o solicitante.

Si se encuentra al menos un certificado, se devuelve un objeto con una estructura JSON similar a la siguiente:

```json
{
  "items": [
    {
    "serialNumber":  "507AEAC03CCEF83F106914418D9222E466A629C1",
    "subject":  "CN=device01.contoso.local",
    "sans":  null,
    "upn":  null,
    "issuanceDate":  "2026-05-28T10:57:22Z",
    "expirationDate":  "2028-05-28T10:57:22Z",
    "revocationDate":  null,
    "revocationReason":  null,
    "revokedBy":  null,
    "requester":  "pkiAdmin@contoso.com",
    "source":  "CertificateMaster",
    "certificateType":  "Static"
    }
  ],
  "continuationToken": "..."
}
```

#### Ejemplo: Buscar un único certificado por número de serie

```powershell
Find-SCEPmanCertificate -Url scepman.conitoso.com `
    -SearchText '5056BB9B823132CB26210A4C90A62FB3C25E38D0' `
    | Select-Object -ExpandProperty items

serialNumber     : 5056BB9B823132CB26210A4C90A62FB3C25E38D0
subject          : CN=clara.oswald@contoso.com
sans             : clara.oswald@contoso.com
upn              : clara.oswald@contoso.com
issuanceDate     : 2026-05-28T11:06:11Z
expirationDate   : 2028-05-28T11:06:11Z
revocationDate   :
revocationReason :
revokedBy        :
requester        : pkiAdmin@contoso.com
source           : CertificateMaster
certificateType  : Static
```

### Comprender los resultados paginados

Si el conjunto de resultados es grande, `Find-SCEPmanCertificate` puede devolver un token de continuación. Usa este token para solicitar la siguiente página.

#### Ejemplo: primera página con token de continuación

```powershell
$result = Find-SCEPmanCertificate -Url scepman.contoso.com -SearchText "CN=device"
$result
```

Ejemplo de salida:

```powershell
ContinuationToken : 1!48!ODY2OURBN0QtQzk0My00QjU3LUI5OEYtNzA5RjY5MDlCRDkw
Items             : {@{serialNumber=60B26DD32CF07F30D6760848A5233CBAE90DCDBC; subject=CN=device01.contoso.local},
                    @{serialNumber=50F1754E85238752527C3140ABD0CEF2C7DC9439; subject=CN=device02.contoso.local}}
```

#### Mostrar los certificados devueltos en detalle

```powershell
$result = Find-SCEPmanCertificate -Url scepman.contoso.com -SearchText "CN=device"
$result.Items
```

Ejemplo de salida:

```powershell
serialNumber                             subject
------------                             -------
60B26DD32CF07F30D6760848A5233CBAE90DCDBC CN=device01.contoso.local
50F1754E85238752527C3140ABD0CEF2C7DC9439 CN=device02.contoso.local
```

#### Solicitar la siguiente página con el token de continuación

```powershell
$firstPage = Find-SCEPmanCertificate -Url scepman.contoso.com -SearchText "CN=device"
$nextPage = Find-SCEPmanCertificate -Url scepman.contoso.com -ContinuationToken $firstPage.ContinuationToken
$nextPage.Items
```

Ejemplo de salida:

```powershell
serialNumber                             subject
------------                             -------
5048D2541F7F401C42B7E943A7C82FB37A179F83 CN=device03.contoso.local
50BCCDA973AEEA55E00FAF4A9A088DFB7564F263 CN=device04.contoso.local
```

### Revocar un certificado

Use `Revoke-SCEPmanCertificate` para revocar un certificado por su número de serie que fue emitido previamente.

```powershell
Revoke-SCEPmanCertificate -SerialNumber "480552CEBBE40FD5D4417532033728F353040000" -RevocationReason CessationOfOperation
```

#### Ejemplo: Buscar un certificado y revocarlo

```powershell
$result= Find-SCEPmanCertificate -Url scepman.contoso.com -SearchText "480552CEBBE40FD5D4417532033728F353040000"
$cert = $result.items

Revoke-SCEPmanCertificate -SerialNumber $cert.Items[0].serialNumber
```

Ejemplo de salida:

```powershell
Revoke-SCEPmanCertificate: El certificado 480552CEBBE40FD5D4417532033728F353040000 se revocó correctamente.
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.scepman.com/es/administracion-de-certificados/management-rest-api/management-api-in-scepmanclient.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
